with ProcessPoolExecutor(max_workers=1) as executor:
def f(a):
if a == 5:
raise Exception("Asdf")
return a
results = executor.map(f, range(200))
while True:
try:
result = results.next()
except Exception as e:
print result
break
所以我有一个函数,然后将该函数映射到列表上。对于某些输入,我有一个例外,对于其中一些输入,它工作正常。我该如何检索所有能够正常从功能f记录异常的结果。