file read, binary or text mode

Terry Reedy tjreedy at udel.edu
Fri Sep 24 14:48:07 EDT 2004


"Askari" <askari at addressNonValide.com> wrote in message 
news:Xns956E4CDA892D7askariaddressNonVali at 207.35.177.135...
> "Guyon Morée" <gumuz at NO_looze_SPAM.net> wrote in
> news:41540121$0$3891$4d4ebb8e at news.nl.uu.net:
>
> "rb" and "r" on a text file is the same if your text file have ascii
> caractere (8bit) but it's not the same for Unicode caractere (16 bit).
> Bref, if you sure that your file is ONLY text, use "r",  else, use always
> "rb".  And "r" don't read the control caractere other that "\n" "\t" .. 
> etc

Newbies, ignore this confusion.

On Windows, text mode autoconverts \r\n to \n on input and viceverse on 
output.  I believe that that is all the difference.  Period.

Terry J. Reedy






More information about the Python-list mailing list