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
原文:https://www.cnblogs.com/chargeworld/p/12245600.html
【说明】:本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!