相关概念

4.4 线程

 进程线程关系图

4.4 线程

threading 模块

线程创建

4.4 线程

  方法形式创建线程

from threading import Thread
import time
def sayhi(name):
    time.sleep(2)
    print('%s say hello' %name)

if __name__ == '__main__':
    t=Thread(target=sayhi,args=('egon',))
    t.start()
    print('主线程')
View Code

相关文章:

  • 2021-11-18
  • 2021-08-10
  • 2021-08-11
  • 2022-12-23
  • 2022-01-05
  • 2022-12-23
  • 2021-05-17
  • 2021-09-04
猜你喜欢
  • 2021-05-02
  • 2021-12-05
  • 2021-06-01
  • 2021-10-27
  • 2021-09-07
  • 2021-05-19
  • 2021-09-02
相关资源
相似解决方案