UnicodeEncodeError: ‘latin-1’ codec can’t encode characters in position 44-46: ordinal not in range(256)
python连接MySQL的时候我也是日狗了,出现了这个错误。网上好多说什么,需要改字符集,资质愚钝不知道他们在说什么,尝试之后还是不行,最后上Stack Overflow解决
pymysql.connect(host='localhost',user='root',password='root',db='test',use_unicode=True, charset="utf8")
连接数据库语句写成这样就OK