"rbt" wrote:

>I believe that this is the safest way to open files on Windows, Linux, Mac and 
>Unix, but I wanted 
>to ask here just to be sure:
>
> fp = file('filename', 'rb')
>
> The 'b' on the end being the most important ingredient (especially on Windows 
> as a simple 'r' on a 
> binary file might cause some sort of corruption).
>
> Anyway, am I right in saying this? That 'rb' is the safest way to open files 
> for reading and that 
> it should work well on *all* Python supported platforms?

"rb" works on all platforms, yes.  but it doesn't work well if you're reading a 
text file.

(when reading text files, the "U" option may also be useful.  see doc for 
details)

</F> 



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to