Python 2.6, File read() problems in Windows Xp

Scott David Daniels Scott.Daniels at Acm.Org
Fri May 8 15:32:56 CEST 2009

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

You get identical results, but you ar lying to the reader of your code.
you should include the 'b' if what you want is bytes (or octets if you
prefer), and not use it if what you expect is "text."   Your code
becomes less confusing by using 'b' properly, even if you see no
particular difference.

--Scott David Daniels
Scott.Daniels at Acm.Org

More information about the Python-list mailing list