python文件、数据库读写编码的问题

读写utf-8文件

  fh = open(file_name, 'r', encoding = 'UTF-8')

读写数据库utf-8格式

  connect = pymysql.connect(host='127.0.0.1', user='root', passwd='123456', db='code_bank', charset='utf8')

原文地址:https://www.cnblogs.com/hushaojun/p/6229362.html