def threadproc(tid):
for i in range(1000000):
print "threadid %i
" %tid
sleep(0.1)
线程函数是这样的
coding=utf-8
import threading
from time import sleep
def threadproc(tid):
for i in range(1000000):
print "threadid %i
" %tid
sleep(0.1)
if name == 'main':
for i in range(100):
t = threading.Thread(target=threadproc,args=(i,))
t.start()