python多线程简单例子

python多线程简单例子


作者:vpoet

mail:vpoet_sir@163.com

 1 import thread
 2 def childthread(threadid):
 3     print "I am child thread",threadid
 4     
 5 
 6 def parentthread():
 7     i=0
 8     while 1:
 9         i+=1
10         thread.start_new_thread(childthread,(i,))
11         if raw_input()=='q':
12             break
13 
14 
15 parentthread()

运行截图:


原文地址:https://www.cnblogs.com/vpoet/p/4659591.html