multi-down in threading module

守株待兔 1248283536 at qq.com
Thu Sep 8 00:50:52 EDT 2011


i want to download data in  multiprocess ,i know the threading structure,but i can't finish it,
would you mind to revise it ?
any advice appreciated.
[code]
import urllib
import threading
URL = "http://download.finance.yahoo.com/d/quotes.csv?s=%s&f=sl1t1v&e=.csv"
symbols = ('GGP', 'JPM', 'AIG', 'AMZN','GGP', 'JPM', 'AIG', 'AMZN')
url =[ URL % '+'.join(sym)  for sym in symbols]

num=rang(3)  

def  down(url):
    print urllib.urlopen(url).read()
  
  
for i in num:   #these code  i can't finish 
    t=threading.Thread(target=down,args=  )
    threads.append(t)
  
  
for i in nmu:
    threads[i].start()
  

for i in num:
     threads[i].join()

[/code]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110908/03b4b566/attachment.html>


More information about the Python-list mailing list