Python 2.6, File read() problems in Windows Xp

Li Wang li.wang.d at gmail.com
Fri May 8 05:08:03 EDT 2009


Hi  Dave:
Thank you very much for you explanation:)


> Chances are you forgot the "b" parameter to open().  Unnecessary in Unix, it
> tells the library to *not* translate \r\n  to \n upon read, or the inverse
> on write.  In other words, with the "b" parameter, the file is read in
> unchanged.

So, if I am using python in Linux, do open('file', 'r') and
open('file', 'rb') work the same way?

Thanks,

Best regards,
Li



More information about the Python-list mailing list