import threading,time def run(num): print 'Hi ,im aaa',num time.sleep(2) print '--->' for i in range(5): t=threading.Thread(target=run,args=(i,)) t.start() #以下为结果 [root@localhost ptest]# python threadt.py Hi ,im aaa 0 Hi ,im aaa 1 Hi ,im aaa 2 Hi ,im aaa 3 Hi ,im aaa 4 ---> ---> ---> ---> --->
python多线程(1)基础
猜你喜欢
转载自886.iteye.com/blog/2323641
今日推荐
周排行