Skip to content

Instantly share code, notes, and snippets.

@Torenable
Last active May 22, 2017 03:04
Show Gist options
  • Save Torenable/c5331e5149e30c151ec1c5f94cddb571 to your computer and use it in GitHub Desktop.
Save Torenable/c5331e5149e30c151ec1c5f94cddb571 to your computer and use it in GitHub Desktop.
How to pass parameters to the workers
import threading
def thread_worker(*args, **kwargs):
pass
t1 = threading.Thread(target = thread_worker, args = (elms), kwargs = {key: value})
t1.start()
t1.join()
# arguments pass to the target function, and
# 1. args, in Thread, must be a tuple
# 2. kwargs, in Thread, must be a dictionary
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment