python多线程简单例子

python多线程简单例子


作者:vpoet

日期:大约在夏季

注:无


import thread
def childthread(threadid):
    print "I am child thread",threadid
    

def parentthread():
    i=0
    while 1:
        i+=1
        thread.start_new_thread(childthread,(i,))
        if raw_input()=='q':
            break


parentthread()
    


运行截图:

python多线程简单例子_第1张图片

你可能感兴趣的:(线程,python)