escape character / csv module

anon anon at blank.com
Thu Jul 1 15:13:02 EDT 2010


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?

This will do what you want:

"\\x00"



More information about the Python-list mailing list