On 01/03/2018 01:35, Tim Chase wrote:
While inelegant, I've "solved" this with a wrapper/generator

   f = file(fname, …)
   g = (line.replace('\0', '') for line in f)
I wondered about something like this but thought if there's a way of avoiding the extra step it would keep the execution speed up. My next thought was to pass a custom encoder to the open() that translates NULLs to, say, 0x01. It won't make any difference to change one corrupt value to a different corrupt value.
   reader = csv.reader(g, …)
   for row in reader:
     process(row)

Regards,
John

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to