首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > perl python >

Python多线程范例

2012-10-24 
Python多线程实例from threading import Threadclass Task(Thread):def __init__(self, count):super(Task

Python多线程实例

from threading import Threadclass 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()

热点排行