Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed0.kamp.net!newsfeed.kamp.net!feeder1.cambriumusenet.nl!feed.tweaknews.nl!85.12.40.139.MISMATCH!xlned.com!feeder7.xlned.com!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!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.083 X-Spam-Evidence: '*H*': 0.83; '*S*': 0.00; 'http': 0.09; 'cc:addr :python-list': 0.11; '24,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subject:download': 0.16; 'subject:requests': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'module': 0.19; 'pieces': 0.19; 'properly': 0.19; 'thu,': 0.19; 'cc:addr:python.org': 0.22; 'certainly': 0.24; 'server.': 0.24; 'file.': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'though.': 0.31; 'file': 0.32; 'figure': 0.32; 'level.': 0.33; 'subject:with': 0.35; 'connection': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'really': 0.36; 'doing': 0.36; 'possible': 0.36; 'subject:?': 0.36; 'server': 0.38; 'pm,': 0.38; 'how': 0.40; "you're": 0.61; 'first': 0.61; "you'll": 0.62; 'different': 0.65; 'biggest': 0.67; 'benefit': 0.68; 'subjectcharset:utf-8': 0.72; 'cut': 0.74; 'jul': 0.74; 'off,': 0.84; '\xe2\x80\x8d': 0.84; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type:content-transfer-encoding; bh=0AQqD6qYMScIGfL3L8YRnq+QwBpq/tOILOyxc93tNyM=; b=AXJrJWz+sXCOX0hW+Mapmm/2+g78IIp7oPoK85K05RBaOseqS4kHyqHbbmfRh/nc99 26mbAQyIV+0rtjSHYhOYpknzSkI5UaX2N1BvfQuCpEc0toa3WewQFkMk9qua6/JO8HuS gDh5fkraUevhGEH8AdieONZ/CajhM3So0L8gvLBMmArEEOvxFwZXNkV2Ce13ED/KnzR/ oIzArFYN0203MQm8BB/26teLoSh/kteJ7dqD7XPnCYBj3IRju4dZkYNYgNIFfBJW6Bl/ GCVKBccSHFszdboGYTZnoJSfymqHbXRnK1o4QiYxCUpNI2nNsns0hvpmzOLzPG6tTl61 BBlg== MIME-Version: 1.0 X-Received: by 10.220.81.194 with SMTP id y2mr7812005vck.29.1406172591994; Wed, 23 Jul 2014 20:29:51 -0700 (PDT) In-Reply-To: References: Date: Thu, 24 Jul 2014 13:29:51 +1000 Subject: =?UTF-8?Q?Re=3A_=E5=9B=9E=E5=A4=8D=EF=BC=9A_how_to_download_special_range_content_?= =?UTF-8?Q?with_requests_in_python=3F?= From: Chris Angelico Cc: python-list Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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: 24 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1406172594 news.xs4all.nl 2898 [2001:888:2000:d::a6]:53796 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:75118 On Thu, Jul 24, 2014 at 1:21 PM, =E6=B0=B4=E9=9D=99=E6=B5=81=E6=B7=B1 <1248= 283536@qq.com> wrote: > i want to write a multiple threads download program to practice my MT > knowledge, > 1)cut the big iso file into 20 parts > 2)start 20 process with threading and queue module to download > 3)combine the 20 parts into one iso file. > > if i have cut it into 20 parts ,how can i download the first part of it ? > > it is target to practice the threading and queue module . =E2=80=8D Well, first off, this won't really benefit much from threading. The biggest bottleneck is going to be the speed of your connection to that server. Fetching in parts is likely to actually take longer. It's certainly possible to do what you want, though. What you want is to figure out how big the file is, and then ask the server to download different pieces of it. But you'll need to properly understand what you're doing on the HTTP level. I would advise finding some other way to practice threading. ChrisA