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)
繼續運行 ?* 回憶上次內容 上次使用shell環境中的命令 命令 作用 c