Avatar ·

Python: 'Charmap' 编解码器无法解码字节 0x98

📁 迭代器, python, 错误, 示例, 工作

下午好,我读取了 UTF8 文件并显示到控制台。当尝试推导字母 "" 和 "" 时出现错误:

file "" I: \\programfile\\anaconda\\lib\\encodings\\cp1251.py "", line 15,  in  decode   retu  codecs.charmap_decode(input, errors, decoding_table) UnicodeDecodeError: 'Charmap' codec can '' 't decode byte 0x98 in position 1: character maps to <undefined>

在这个示例中重现:

test_text_1 = "" Task  "" test_text_2 =  file = open('' tamp.txt ', , 'w', encoding =