how to download internet files by python ?
Rodrick Brown
rodrick.brown at gmail.com
Tue Jan 8 00:00:37 EST 2013
On Mon, Jan 7, 2013 at 11:19 PM, iMath <redstone-cold at 163.com> 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())
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20130108/a9f56692/attachment.html>
More information about the Python-list
mailing list