Friday 15 May 2015

python - Write a string when I wait for the return answer of a function -



python - Write a string when I wait for the return answer of a function -

i have function handles , returns data.

when run code, take 5 sec homecoming answer. possible else @ same time? instance, i'd write simple line "loading...".

would thread work?

you utilize built-in class thread.thread, e.g.

import threading def data_processing(): pass def print_some_jokes(): pass def do_both(): t1 = threading.thread(target=data_processing) t2 = threading.thread(target=print_some_jokes) t1.start() t2.start() t1.join() t2.join() both = threading.thread(target=do_both) both.start() both.join()

python return wait

No comments:

Post a Comment