Start 10 copies of a function running in parallel

2019-06-16 02:07栏目:技术创新

import thread

def counter(myId, count):
    for i in range(count): print '[%s] => %s' % (myId, i)

for i in range(10):
    print thread.start_new(counter, (i, 100))

import time
time.sleep(3) 
print 'Main thread exiting.'  

版权声明:本文由新浦京娱乐站_新浦京娱乐场官网_新浦京娱乐发布于技术创新,转载请注明出处:Start 10 copies of a function running in parallel