0
我剛剛瞭解多線程,並得到一些教程下面的代碼:檢查線程時間
import urllib2
from multiprocessing.dummy import Pool as ThreadPool
urls = [
'http://www.python.org',
'http://www.python.org/about/',
'http://www.onlamp.com/pub/a/python/2003/04/17/metaclasses.html',
'http://www.python.org/doc/',
'http://www.python.org/download/',
'http://www.python.org/getit/',
'http://www.python.org/community/',
'https://wiki.python.org/moin/',
]
# open the urls in their own threads and return the results
with Pool(4) as pool:
results = pool.map(urllib2.urlopen, urls)
有人能告訴我怎麼做,我發現採取相同的時間?