On Fri, 2007-08-03 at 11:48 -0700, Ehsan wrote:
> I foundd this code in ASPN  Python Cookbook for downloading files in
> python but when it finished downloading files the files became
> corrupted and didn't open, the files in internet havn't any problem:
> 
> 
> def download(url,fileName):
>       """Copy the contents of a file from a given URL
>       to a local file.
>       """
>       import urllib
>       webFile = urllib.urlopen(url)
>       localFile = open(fileName, 'w')
> [...]

Try 'wb' instead of 'w'.

-- 
Carsten Haese
http://informixdb.sourceforge.net


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

Reply via email to