ITeye博客

Python多线程实例

rokuan · 2011-07-26 22:00 · Python · 编程语言 · Markdown


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()

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。