python utf8编码笔记
1.mysql编码
db = MySQLdb.connect(host="xxx", user="xxx", passwd="xxx", db="xxx",charset="utf8", autocommit=True)
2. pandas编码
修改系统编码
import sys
reload(sys)
sys.setdefaultencoding('utf8')
read_csv
import pandas as pd
pd.read_csv(input_path, encoding='utf-8')
3. json编码
key_words="tuyến_tiền_liệt"
json.dumps(key_words).decode('unicode-escape').encode('utf8')