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


Groups > comp.lang.python > #36435

Re: how to download internet files by python ?

Date 2013-01-08 15:19 +0000
From MRAB <python@mrabarnett.plus.com>
Subject Re: how to download internet files by python ?
References <e4fc5450-8816-471f-8f03-ed9229b64602@googlegroups.com> <CABRP1o-u1VpHTVZ6JmdfYm57pGhMULA2+6P0Wk41LRv9UnwJWg@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.279.1357658388.2939.python-list@python.org> (permalink)

Show all headers | View raw


On 2013-01-08 05:00, Rodrick Brown wrote:
> On Mon, Jan 7, 2013 at 11:19 PM, iMath <redstone-cold@163.com
> <mailto: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())
>
Why not just use urlretrieve?

Back to comp.lang.python | Previous | NextPrevious 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