import threading,_thread
def action(i):
print(i **32)
#帶有狀態的子類
class Mythread(threading.Thread):
def __init__(self, i):
self.i = i
threading.Thread.__init__(self)
def run(self):
print(self.i ** 32)
Mythread(2).start()
#傳入行為
thread = threading.Thread(target=(lambda: action(2))
thread.start()
#不封裝lambda
thread.Thread(target=action, args=(2,)).start()
#基本的線程模塊
_thread.start_new_thread(action,(2,))