【发布时间】:2018-08-23 19:01:18
【问题描述】:
这个在 Windows 上运行的 Python 2.7 脚本没有像我预期的那样输出。
from multiprocessing import Pool
from multiprocessing.dummy import Pool as ThreadPool
def function1():
function1List = ["11" ,'22' , '33']
return function1List
def function2(passedList):
for item in passedList:
print item
list = function1()
#print list used to verify list
if __name__ == '__main__':
pool = ThreadPool()
pool.map(function2, list)
pool.close()
pool.join()
我的期望
11
22
33
44
我实际上得到了什么
1
1
2
2
3
3
4
4
我错过了什么?
【问题讨论】:
标签: python multiprocessing threadpool pool