孤独的猫

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

多线程编程需要引用threading包

import threading
class mythread(threading.Thread):
 def __init__(self,num):
  threading.Thread.__init__(self)
  self.num=num
 def run(self):
  print('I am ',self.num)
t1=mythread(1)
t2=mythread(2)
t3=mythread(3)
t1.start()
t2.start()
t3.start()
           

posted on 2011-04-27 20:46  孤独的猫  阅读(297)  评论(0编辑  收藏  举报