HI, everyone. I am new to Python and use Python 2.5 on CentOS.
I need to download files like WGET do.
I did some searching, and there are some solutions, the obvious way:
import urllib2 mp3file = urllib2.urlopen("http://www.example.com/songs/mp3.mp3") output = open('test.mp3','wb') output.write(mp3file.read()) output.close()
It works great. But I want to know if the mp3 file is VERY large, for example, 1Gb, 2Gb or even more. Can this piece of code work? Are there any better ways to load large files in Python, perhaps with a progress bar like WGET do.
Thanks a lot!
source share