1. 程式人生 > >ERROR 'latin-1' codec can't encode characters in position 81-86: ordinal not in range(256)問題解決

ERROR 'latin-1' codec can't encode characters in position 81-86: ordinal not in range(256)問題解決

使用pymysql時,出現了編碼問題,可以在連線時進行宣告:

db = pymysql.connect('{}'.format(host), '{}'.format(username), '{}'.format(pwd), '{}'.format(database),
                         use_unicode=True, charset="utf8")