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,))

相关文章:

  • 2021-12-28
  • 2021-11-26
  • 2021-11-18
  • 2021-07-12
  • 2022-01-14
  • 2022-12-23
猜你喜欢
  • 2022-01-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-30
  • 2021-08-12
  • 2021-10-18
相关资源
相似解决方案