首页 > 编程语言 > 详细

Python简单的多线程demo:装逼写法

时间:2018-09-16 19:13:41      阅读:207      评论:0      收藏:0      [点我收藏+]

用面向对象来写多线程:

import threading

class MyThread(threading.Thread):
    def __init__(self, n):
        super(MyThread, self).__init__()
        self.n = n
    def run(self):
        print("running task:",self.n)


t1 = MyThread("t1")
t2 = MyThread("t2")
t1.start()
t2.start()

 

Python简单的多线程demo:装逼写法

原文:https://www.cnblogs.com/staff/p/9656913.html

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