csv module and NULL data byte
Terry Reedy
tjreedy at udel.edu
Wed Feb 28 21:57:43 EST 2018
On 2/28/2018 8:35 PM, Tim Chase wrote:
> While inelegant, I've "solved" this with a wrapper/generator
>
> f = file(fname, …)
> g = (line.replace('\0', '') for line in f)
> reader = csv.reader(g, …)
> for row in reader:
> process(row)
I think this is elegant in that is cleans the input stream independently
of the consumer. It is easier than what I was going to suggest, which
is to read the cvs source for the line that raises the exception and
modify the code until it works with \0 in the stream.
--
Terry Jan Reedy
More information about the Python-list
mailing list