I have a short Python script for reading CSV files. So far nothing special.
def csvReader(filename):
return csv.reader(open(filename,'tr', encoding='utf-8'))
for row in csvReader('test.csv'):
print(row)
However, it triggers an error message if the CSV file contains the word "NUL" in a field. E.g. like this:
timestamp_utc,id, text,key
2021-07-15 13:47:01,12345,"Some text,sfghj",z3O9ZNULdxBfR
If I now read in this CSV file (which, by the way, is not created by me, it is delivered externally), I get this error message:
_csv.Error: line contains NUL
Curiously, if I open the file in the simple Windows editor and save it without changing anything, the error does not occur and the file is processed normally.
General conditions: Windows, Pycharm, Python 3.8