python读文件,TypeError: a bytes-like object is required, not 'str'
时间:2020-07-05 00:27:39
收藏:0
阅读:167
2种方法:
1.open文件设置encoding
file = open(filename, ‘r‘, encoding=‘UTF-8‘)
2.用encode方法
str = str.encode()
评论(0)