继承于threading,重写构造方法:
import threading
class th(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
print("__init__")
def run(self):
print("run")
t=th()
t.start()
t.join()
output:
__init__
run
继承于threading,重写构造方法:
import threading
class th(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
print("__init__")
def run(self):
print("run")
t=th()
t.start()
t.join()
output:
__init__
run