1. 首页
  2. 数据库
  3. 其它
  4. Python threading多线程编程实例

Python threading多线程编程实例

上传者: 2021-02-23 18:12:06上传 PDF文件 50.83KB 热度 26次
Python 的多线程有两种实现方法: 函数,线程类 1.函数 调用 thread 模块中的 start_new_thread() 函数来创建线程,以线程函数的形式告诉线程该做什么 复制代码 代码如下: # -*- coding: utf-8 -*- import thread def f(name): #定义线程函数 print “this is ” + name if __name__ == ‘__main__’: thread.start_new_thread(f, (“thread1”,)) #用start_new_thread()调用线程函数和其他参数 whi
用户评论