0

I tried with this code it says UnicodeDecodeError.

base_file =open(textfiles[i], encoding='utf-16-le')
text = base_file.read()
  • Does this answer your question? [UnicodeDecodeError when reading a text file](https://stackoverflow.com/questions/30777370/unicodedecodeerror-when-reading-a-text-file) – Axisnix Dec 16 '20 at 15:21
  • Use `utf_16_le` or `UTF-16LE`. From [here](https://docs.python.org/3/library/codecs.html#standard-encodings) – progmatico Dec 16 '20 at 18:40

0 Answers0