首页 > 技术文章 > python读取数据库数据,读取出的中文乱码问题

jzss 2016-06-07 16:05 原文

conn = pymysql.connect(
host='127.0.0.1',
port=3302,
user='username',
passwd='password',
db=database,
charset='utf8')
#此处要指定charset为utf-8(一般数据库编码都是utf8或utf8mb4之类),否则读取出的中文会乱码

 

推荐阅读