我正在尝试读取文件,(密码列表),我收到以下错误:
Traceback (most recent call last):
File "C:\Users\ayden\Documents\2.1 Hacks\Python\PowerUp\FTPCracker.py", line 25, in <module>
passwords = file.read()
File "C:\Users\ayden\AppData\Local\Programs\Python\Python35-32\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x8f in position 1911885: character maps to <undefined>
它太大还是有一些奇怪的不允许的角色?
答案 0 :(得分:1)
检查文件的编码,然后在打开时指定相同的文件。
例如,如果它是UTF8编码的,那么请执行:
file = open(filename, encoding="utf8")