python 多线程模板

 1 #多线程模板
 2 import threading
 3 class A(threading.Thread):
 4     def __init__(self):
 5         threading.Thread.__init__(self)
 6     def run(self):
 7         for i in range(0,10):
 8             print("线程A")
 9 class B(threading.Thread):
10     def __init__(self):
11         threading.Thread.__init__(self)
12     def run(self):
13         for i in range(0,10):
14             print("线程B")
15 
16 t1=A()
17 t1.start()
18 t2=B()
19 t2.start()

 

posted @ 2018-09-19 11:15  发酸的丶蛋炒饭  阅读(360)  评论(0编辑  收藏  举报