Answers for "python threading return data from thread"

0

python threading return value

import concurrent.futures

def foo(bar):
    print('hello {}'.format(bar))
    return 'foo'

with concurrent.futures.ThreadPoolExecutor() as executor:
    future = executor.submit(foo, 'world!')
    return_value = future.result()
    print(return_value)
Posted by: Guest on August-08-2021

Code answers related to "python threading return data from thread"

Python Answers by Framework

Browse Popular Code Answers by Language