Skip to content

Instantly share code, notes, and snippets.

@studiawan
Created October 31, 2013 18:35
Show Gist options
  • Save studiawan/7254659 to your computer and use it in GitHub Desktop.
Save studiawan/7254659 to your computer and use it in GitHub Desktop.
Thread example in Python 05
# http://pymotw.com/2/threading/
import threading
import logging
logging.basicConfig(level=logging.DEBUG, format='(%(threadName)-10s) %(message)s', )
class MyThread(threading.Thread):
def __init__(self, num):
threading.Thread.__init__(self)
self.num = num
def run(self):
logging.debug(str(self.num) + ' running')
for i in range(5):
t = MyThread(i)
t.start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment