1.使用scrapy对数据进行入库时,出现如下错误:

UnicodeEncodeError:'latin-1' codec can't encode characters in position 0-1: ordinal not in range(256)

解决方法,在sql.py中,或者是链接数据库时,添加:

UnicodeEncodeError:'latin-1' codec can't encode characters in position 0-1: ordinal not in range(256) Scrapy

 

2.如果是其他情况出现的,可使用:

create_engine('mysql+mysqldb://USER:@SERVER:PORT/DB?charset=utf8', encoding='utf-8')

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-06-01
  • 2022-01-01
  • 2022-12-23
  • 2021-09-15
猜你喜欢
  • 2022-12-23
  • 2021-09-13
  • 2022-12-23
  • 2021-06-29
相关资源
相似解决方案