以r/w打开文件时,可以用encoding设定打开格式,不设置在windows默认为gbk
以rb/wb二进制打开文件时,不可以用encoding设定打开格式
#第一次知道还有errors
with open(r"H:\1.txt","r", encoding='utf-8', errors='ignore') as f:
a = f.readlines()
编码问题
http://c.biancheng.net/view/4305.html
以r/w打开文件时,可以用encoding设定打开格式,不设置在windows默认为gbk
以rb/wb二进制打开文件时,不可以用encoding设定打开格式
#第一次知道还有errors
with open(r"H:\1.txt","r", encoding='utf-8', errors='ignore') as f:
a = f.readlines()
编码问题
http://c.biancheng.net/view/4305.html