首先是: 因为编码不一致引起插不进去错误的解决:

conn = pymysql.connect(user='root', passwd='root', host='localhost', db='weibo',use_unicode=True, charset="utf8")
即设置 use_unicode=True, charset="utf8"

其次是: 插入进去之后的中文乱码的解决:

设置MySQL数据库表的编码为utf8或gbk等支持中文的编码

具体方法:

Python插入时中文乱码问题的解决办法

有一个很好的链接,它解释了乱码问题的原因:http://blog.csdn.net/zhenyu5211314/article/details/19806535

相关文章:

  • 2021-11-09
  • 2021-12-27
  • 2022-12-23
  • 2022-12-23
  • 2021-10-20
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-18
  • 2022-02-18
相关资源
相似解决方案