I have opened and read csv files in python many times before, but for some reason I keep getting this error this time.
Error:
File "C:\Program Files\Python37\lib\encodings\cp1250.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x90 in position 22: character maps to <undefined>
My code:
with open("databa.csv", 'r') as fp:
for line in fp:
print(line)
I have already tried renaming the file, setting the format as 'UTF8' or ignoring the errors ("databa.csv", 'r', errors='ignore') but none of it worked
with open(r"databa.csv", 'rb') as fp:
with open("databa.csv", 'r', buffering=0) as fp:
with open("databa.csv", errors="ignore") as fp:
with open("databa.csv",encoding='utf8', errors="ignore") as fp:
with open("databa.csv",encoding='utf8', "r") as fp:
with open("databa.csv", encoding='utf8', "r") as fp