Answer the question
In order to leave comments, you need to log in
What to do with encodings in python 3?
Actually, the program scans the folder using os.listdir() and outputs all files to the console, as soon as it reaches the "GoL - copy.dat" file, it gives an error
File "C:\Users\korwi\AppData\Local\Programs\Python\Python35-32\lib\encodings\cp866.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_map)[0 ]
UnicodeEncodeError: 'charmap' codec can't encode character '\u2014' in position
4: character maps to
Answer the question
In order to leave comments, you need to log in
apparently because the console is not utf-8 encoding. In the Windows console before win10 there was generally cp866, in win10 it seems to have become win1251, it would be worthwhile to clarify then which system, whether that console. Because there are no problems with encodings in python3.
everything is fine in win10
import os
os.listdir()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question