Python reptile problem encountered and solutions

( 1) after being given the run: "TypeError: can not use a string pattern on a bytes-like"

Reason: Content decoded by decode ( 'utf-8') , the bytes into string. py3 of urlopen not return string is bytes.

Solution: the 'content' adjust Type: content.decode ( 'utf-8' )

 

 

( 2) After being given the run: "sqlite3.InterfaceError: Error binding parameter 1 - probably unsupported type"

Reason: the data type is a list is taken out , and does not match the database design field, you need to be treated as a string data type.

 

Solution: through the list, all the elements splicing list as a string

 

 

Guess you like

Origin www.cnblogs.com/hyz1900457346/p/12080603.html