如果文件包含这种类型的行:
第一的
第二
那么一切都很好,但如果他们从
像这样的“@”例如@David,@masha,@sergey
然后出现错误
return codecs.charmap_decode(input,self.errors,decoding_table)[0] UnicodeDecodeError: 'charmap' codec can't decode byte 0x98 in position 2291:character maps to undefined>
我知道错误与编码有关,但我不明白要修复什么,以及在什么情况下(使用什么字符时)会出现这样的错误。
编码
ra = open("user_name", "r")
for i in ra:
print(i)
打开文件时尝试指定编码: