worker321 发表于 2017-4-24 13:04:34

Python多线程实例

from threading import Thread
class Task(Thread):
def __init__(self, count):
super(Task, self).__init__()
#Thread.__init__(self)
self.count = count
def run(self):
for i in range(10):
print 'Task' + str(self.count) + ':' + str(i)
if __name__ == '__main__':
for i in range(10):
Task(i+1).start()
页: [1]
查看完整版本: Python多线程实例