Python link Mysql write data report Python'_elementunicoderesult' cannot be converted to a MySQL type error

Sometimes crawling page data directly using native SQL to batch insert the database will cause the following error:

Failed processing pyformat-parameters; Python '_elementunicoderesult' cannot be converted to a MySQL type

This is because the string obtained through lxml.etree may be _elementunicoderesult, which is a kind of string in Python. The method of directly storing the data format in the database does not convert the type variable into a SQL object, so it needs to be forced Convert to str type, and then save the data!

Guess you like

Origin blog.csdn.net/Lin_Hv/article/details/109737570