首页 > 编程语言 > 详细

python线程进程

时间:2020-01-31 16:40:40      阅读:72      评论:0      收藏:0      [点我收藏+]

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

python线程进程

原文:https://www.cnblogs.com/chargeworld/p/12245600.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!