Skip to content

Instantly share code, notes, and snippets.

@tankywoo
Last active December 13, 2015 21:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tankywoo/4975346 to your computer and use it in GitHub Desktop.
Save tankywoo/4975346 to your computer and use it in GitHub Desktop.
import threading
def worker():
"""thread worker function"""
print 'Worker'
return
threads = []
for i in range(5):
t = threading.Thread(target=worker)
threads.append(t)
t.start()
# 输出:
# Worker
# -Worker
# Worker
# -Worker
# Worker
# '-'表示一个空格,结果每次不一样,可能还会有换行
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment