python mysql设置当前连接默认的字符集
时间:2021-07-01 10:21:17
帮助过:20人阅读
‘utf8‘)
#连接时设置
‘‘‘
set the default character set for the current connection
character_set_client
character_set_results
‘‘‘
cursor = db.cursor(cursorclass =
MySQLdb.cursors.DictCursor)
cursor.execute(‘SET NAMES utf8;‘)
#使用游标设置
最终导致的结果是:
current connection
character_set_client
character_set_results
统统都是utf8
python mysql设置当前连接默认的字符集
标签:log dict rac client 连接 nec res efault logs