Python 操作Mysql
python 插入 汉字:
# -*- coding: utf8 -*- import MySQLdb from datetime import date try: con = MySQLdb.Connect(host='localhost', user='root', passwd='wm8766130', db='bjwjzs', port=3306, charset='utf8')
必须两个地方都声明编码
如何打印utf-8汉字: # -*- coding: utf8 -*- 即可