親の辞書に書き込むにはどうすればよいですか? 取得する一部の子に URL のリストを提供しました。次に、親の辞書に書き込む必要があります。
from multiprocessing import Pool
import random
parent_dict={}
urls = ['www.yahoo.com','www.google.com','www.microsoft.com','www.apple.com','www.cisco.com']
def workit(url):
# retrieve the urls, process some stuff and then add that info to parent_dict
key = random.randrange(1,10) # pretend that this is the variable that we want in parent_dict
value = random.randrange(11,20)
parent_dict[key] = value
pool = Pool(processes = 5)
pool.map(workit,urls)
print parent_dict # returns {}}