AttributeError: ‘NoneType’ object has no attribute ‘encoding’
解决方法:
我创建connect对象时,我想使用的编码方式是“utf-8”,然后它说我没有这种编码方式,所以将"utf-8"改为“gbk”就OK了。有可能你们的有"utf-8"没有"gbk",却写成了"gbk"也是会显示这种错误,具体情况具体分析,反正报这种错误就是你没有这种编码方式,换另一种编码方式就OK了
# 创建connection对象
conn = pymysql.connect(host="localhost", port=3306, user="root", password="123456", database="python", charset="utf-8")
# 创建connection对象
conn = pymysql.connect(host="localhost", port=3306, user="root", password="123456", database="python", charset="gbk")