The function foo
below returns a string 'foo'
. How can I get the value 'foo'
which is returned from the thread's target?
from threading import Threaddef foo(bar): print('hello {}'.format(bar)) return 'foo'thread = Thread(target=foo, args=('world!',))thread.start()return_value = thread.join()
The "one obvious way to do it", shown above, doesn't work: thread.join()
returned None
.