Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #36411

Re: how to download internet files by python ?

References <e4fc5450-8816-471f-8f03-ed9229b64602@googlegroups.com>
From Rodrick Brown <rodrick.brown@gmail.com>
Date 2013-01-08 00:00 -0500
Subject Re: how to download internet files by python ?
Newsgroups comp.lang.python
Message-ID <mailman.260.1357621271.2939.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Mon, Jan 7, 2013 at 11:19 PM, iMath <redstone-cold@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())

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

how to download internet files by python ? iMath <redstone-cold@163.com> - 2013-01-07 20:19 -0800
  Re: how to download internet files by python ? Cameron Simpson <cs@zip.com.au> - 2013-01-08 15:44 +1100
    Re: how to download internet files by python ? Roy Smith <roy@panix.com> - 2013-01-08 00:04 -0500
      Re: how to download internet files by python ? iMath <redstone-cold@163.com> - 2013-01-09 18:08 -0800
        Re: how to download internet files by python ? Tim Roberts <timr@probo.com> - 2013-01-09 20:31 -0800
  Re: how to download internet files by python ? Rodrick Brown <rodrick.brown@gmail.com> - 2013-01-08 00:00 -0500
  Re: how to download internet files by python ? MRAB <python@mrabarnett.plus.com> - 2013-01-08 15:19 +0000

csiph-web