On 2013-01-08 05:00, Rodrick Brown wrote:
On Mon, Jan 7, 2013 at 11:19 PM, iMath <[email protected] <mailto:[email protected]>> wrote:for example ,if I want to download this file ,how to implement the download functionality by python ? http://down.51voa.com/201208/se-ed-foreign-students-friends-16aug12.mp3 as for download speed ,of course ,the fast ,the better ,so how to implement it ? It would be better to show me an example :) thanks !!! -- http://mail.python.org/mailman/listinfo/python-list #!/usr/bin/python import urllib2 if __name__ == '__main__': fileurl='http://down.51voa.com/201208/se-ed-foreign-students-friends-16aug12.mp3' mp3file = urllib2.urlopen(fileurl) with open('outfile.mp3','wb') as output: output.write(mp3file.read())
Why not just use urlretrieve? -- http://mail.python.org/mailman/listinfo/python-list
