Python3 自定义threading 的 __init__ 方法使用

论坛 期权论坛 编程之家     
选择匿名的用户   2021-5-31 00:31   28   0
import threading
import time


class My_threading(threading.Thread):
    def __init__(self,name,num):
        super().__init__()
        self.name = name
        self.num = num

    def run(self):
        time.sleep(3)
        print(self.name,self.num)

要写 super().__init__() 要不然会报错

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:3875789
帖子:775174
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP