V N wrote:
string "\x00" has a length of 1.  When I use the csv module to write
that to a file

csv_f = csv.writer(file("test.csv","wb"),delimiter="|")
csv_f.writerow(["\x00","zz"])

The output file looks like this:
|zz

Is it possible to force the writer to write that string?

It can write "\x01" but not "\x00", and "\x00ABC" doesn't write anything
either.

The csv module imports from _csv, which suggests to me that there's code
written in C which thinks that the "\x00" is a NUL terminator, so it's a
bug, although it's very unusual to want to write characters like "\x00"
to a CSV file, and I wouldn't be surprised if this is the first time
it's been noticed! :-)
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to