1.在python中用MySQLdb库连接mysql数据库时
db = MySQLdb.connect(host="localhost", user="root", passwd="user", db="test", charset="utf8")
其中(charset=“utf8”)应该和mysql中的字符编码相同
2.在python中如果要打印出utf8的中文字符,应该是
print "%s” % (utf8_str)
1.在python中用MySQLdb库连接mysql数据库时
db = MySQLdb.connect(host="localhost", user="root", passwd="user", db="test", charset="utf8")
其中(charset=“utf8”)应该和mysql中的字符编码相同
2.在python中如果要打印出utf8的中文字符,应该是
print "%s” % (utf8_str)