1.open文件设置encoding
file = open(filename, 'r', encoding='UTF-8')
2.用encode方法
str = str.encode()
参考:https://www.fujieace.com/python/str-bytes.html
file = open(filename, 'r', encoding='UTF-8')
str = str.encode()
参考:https://www.fujieace.com/python/str-bytes.html
相关文章: