Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; '__name__': 0.07; 'urllib2': 0.07; 'python': 0.09; 'subject:files': 0.09; 'cc:addr :python-list': 0.10; 'subject:python': 0.11; 'skip:# 20': 0.13; "'__main__':": 0.16; '11:19': 0.16; 'subject:download': 0.16; 'subject:internet': 0.16; 'mon,': 0.16; 'wrote:': 0.17; 'jan': 0.18; 'import': 0.21; 'cc:2**0': 0.23; 'example': 0.23; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'skip:# 10': 0.27; 'message-id:@mail.gmail.com': 0.27; 'url:mailman': 0.29; 'subject: ?': 0.30; 'implement': 0.32; 'url:python': 0.32; 'file': 0.32; 'url:listinfo': 0.32; 'received:google.com': 0.34; 'thanks': 0.34; 'pm,': 0.35; 'received:209.85': 0.35; 'skip:u 20': 0.36; 'url:org': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'skip:o 20': 0.38; 'header:Received:5': 0.40; 'url:mail': 0.40; '!!!': 0.62; 'show': 0.63; ',the': 0.84; '2013': 0.84; 'to:addr:163.com': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=VLfu5X9P3BVb7j/lpBgbyE7Uhcb6fNOl6WXmcVRnT/E=; b=F1Da1RQvjGJ4tJVA65RIU+DhuL3zkcuhQHymIsJnTUCriqpjQk2cW6iNXRCNbmAIAY UgCWyLTajXU2zDNUIG90F269WOC/nugBL5B/oS157nhOChzLUsX8C7P3mO7BI2nlJ2Bs tWejj+D6Oypsn3B6nJf/jFP7ThSread8KX1ZhjbuLTsFlQEs+BQcOsny++d5Sv7bvfc6 YOFcRlGYOI45BkUMrbUjimIHj0kUTVLHuoBAmOQcF3D6LiohRksQZkW+T60fuX7JlyH+ +ZmbSKSqwJM1krhKgNf8dSXG5swpX+AZk92pmYApp4a22V02bxgx2rDaU27T640eVpLM 3lnQ== MIME-Version: 1.0 In-Reply-To: References: From: Rodrick Brown Date: Tue, 8 Jan 2013 00:00:37 -0500 Subject: Re: how to download internet files by python ? To: iMath Content-Type: multipart/alternative; boundary=047d7b15ae815e3c4204d2bfd553 Cc: "python-list@python.org" X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 66 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1357621271 news.xs4all.nl 6881 [2001:888:2000:d::a6]:49686 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:36411 --047d7b15ae815e3c4204d2bfd553 Content-Type: text/plain; charset=ISO-8859-1 On Mon, Jan 7, 2013 at 11:19 PM, iMath 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()) --047d7b15ae815e3c4204d2bfd553 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
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 imple= ment the download functionality by python ?

http://down.51voa.com/201208/se-ed-foreign-stude= nts-friends-16aug12.mp3

as for =A0download speed ,of course ,the fast ,the better ,so how to implem= ent 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__ =3D=3D = 9;__main__':

=A0 =A0 mp3file =3D urllib2.urlopen(fileurl)
= =A0 =A0 with open('outfile.mp3','wb') as output:
= =A0 =A0 =A0 =A0 output.write(mp3file.read())
--047d7b15ae815e3c4204d2bfd553--