#用于转换bit在pymysql中显示为x00的问题
from pymysql import converters
converions = converters.conversions
converions[pymysql.FIELD_TYPE.BIT] = lambda x: '0' if '\x00' else '1'

 

然后在connection中加上:

mysql_info = pymysql.connect(Mysql_yrs_ip_port,Mysql_yrs_username,Mysql_yrs_passwd,Mysql_yrs_db,Mysql_yrs_port,charset='utf8',conv=converions)

posted on 2017-09-18 18:33  洛丹伦的雪  阅读(692)  评论(1编辑  收藏  举报