Python 2.6, File read() problems in Windows Xp

Li Wang li.wang.d at gmail.com
Fri May 8 15:47:23 CEST 2009


2009/5/8 Scott David Daniels <Scott.Daniels at acm.org>:
> 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.
>
Thanks a lot, very helpful:D
>



-- 
Li
------
Time is all we have
and you may find one day
you have less than you think



More information about the Python-list mailing list