I am trying to read a dictionary_format_file.txt but I keep getting the error at line.
I read other posts and they made complete sense, however I could not fix my problem still.
Any help is appreciated.
import ast
path = '/Users/xyz/Desktop/final/'
filename = 'dictionary_format_text_file.txt'
with open((path+filename), 'r') as f:
s=f.read()
s=s.encode('ascii', 'ignore').decode('ascii')
Error:
Traceback (most recent call last):
File "/Users/xyz/Desktop/final/boolean_query.py", line 347, in <module>
s=s.encode('ascii', 'ignore').decode('ascii')
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
builtins.UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 81201: ordinal not in range(128)