python线程进程

import threading
import time

def print_111():
while 1:
print('1111')
time.sleep(1)
def print_222():
while 1:
print('222')
time.sleep(1)

threads = []

t1 = threading.Thread(target=print_111)
threads.append(t1)
t2 = threading.Thread(target=print_222)
threads.append(t2)
if __name__=='__main__':
for t in threads:
t.start()
for t in threads:
t.join()
print ("退出线程")
————————————————
版权声明:本文为CSDN博主「英俊幽默又有才」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_34824856/article/details/80939449

上一篇:P2341 [USACO03FALL][HAOI2006]受欢迎的牛 G 题解


下一篇:python学习之名称空间与作用域