File: class/Extras/Code/Misc/thread1.py

# spawn threads until you type 'q'

import thread

def child(tid):
    print 'Hello from thread', tid

def parent():
    i = 0
    while 1:
        i = i+1
        thread.start_new(child, (i,))
        if raw_input() == 'q': break

parent()



[Home page] Books Code Blog Python Author Train Find ©M.Lutz