SNIPPET:
with open("sample.txt", 'r') as f:
filedata = f.read()
ERROR that I get: UnicodeDecodeError Traceback (most recent call last) in
1 `with open("sample.txt", 'r') as f:`
----> 2 filedata = f.read()
3
C:\ProgramData\Anaconda3\lib\encodings\cp1252.py in decode(self, input, final)
21 `class IncrementalDecoder(codecs.IncrementalDecoder):`
22 `def decode(self, input, final=False):`
---> 23 return codecs.charmap_decode(input,self.errors,decoding_table)[0]
24
25 class StreamWriter(Codec,codecs.StreamWriter):
UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 1768: character maps to
Please help me to understand what is the cause of this error and how it can be solved. THANK YOU.