csv module and NULL data byte

Tim Chase python.list at tim.thechases.com
Wed Feb 28 21:52:59 EST 2018


On 2018-02-28 21:38, Dennis Lee Bieber wrote:
> >     with open( fname, 'rt', encoding='iso-8859-1' ) as csvfile:  
> 
> 	Pardon? Has the CSV module changed in the last year or so?
> 
> 	Last time I read the documentation, it was recommended that
> the file be opened in BINARY mode ("rb").

It recommends binary mode, but seems to largely work fine with
text/ascii mode or even arbitrary iterables.  I've not seen the
rationale behind the binary recommendation, but in 10+ years of using
the csv module, I've not found any issues in using text/ascii mode
that were solved by switching to using binary mode.

-tkc





More information about the Python-list mailing list