I have the following code:
from concurrent.futures import ThreadPoolExecutor
def load_database():
with ThreadPoolExecutor(max_workers=10) as executor:
futures = [executor.submit(load_person, x) for x in range(max_people - 1)]
for future in as_completed(futures):
return(future.result())
print(futures)
I am getting "NameError: name 'as_completed' is not defined"
Do I need to import something else to use as_completed?
Thanks, Chrissy
as_completed
lives in concurrent.futures
so you'll need from concurrent.futures import as_completed