Hello everyone
This is my program :
OLD_PATH = ‘Recherche.csv’
NEW_PATH = ‘Travail.csv’
out = open(“Out.txt”, ‘w’)
old = open(OLD_PATH, ‘r’)
old_lines = list(old)
old.close()
new = open(NEW_PATH, ‘r’)
new_lines = list(new)
new.close()
for line in unified_diff(old_lines, new_lines, fromfile=OLD_PATH, tofile=NEW_PATH):
out.write(line)
I would like to compare 2 csv files and display the difference with this program but it displays this error message :
C:\Users\l.rupert\PycharmProjects\Saleforce.venv\Scripts\python.exe C:\Users\l.rupert\PycharmProjects\Saleforce\test.py
Traceback (most recent call last):
File “C:\Users\l.rupert\PycharmProjects\Saleforce\test.py”, line 7, in
old_lines = list(old)
^^^^^^^^^
File “C:\Users\l.rupert\AppData\Local\Programs\Python\Python312\Lib\encodings\cp1252.py”, line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: ‘charmap’ codec can’t decode byte 0x8d in position 1822: character maps to
Process finished with exit code 1
Can you help me?
Thanks