downloading files

Fabio Z Tessitore fabioztessitore at libero.it
Fri Aug 3 23:45:49 CEST 2007


Il Fri, 03 Aug 2007 14:32:19 -0700, Ehsan ha scritto:


> It works but could you explain more what's wrong with just 'w'?

On Unix-like systems newline means '\n'

On Window newline means '\r\n'

So, when you open a file on Window with 'w' option, Win replace 
downloaded '\n' with a local '\r\n' and the file isn't readable. If you 
use 'wb' you say that you want a binary copy ('b' option) and Win doesn't 
replace anything.

Hope it is useful,

bye
Fabio



More information about the Python-list mailing list