Python线程的两种创建方法
来源:互联网 发布:sql 约束类型 编辑:程序博客网 时间:2024/05/18 17:59
第一种:
__author__ = 'LL_YING'import threading# 通过继承Thread创建类class newThread(threading.Thread): def __init__(self, num): threading.Thread.__init__(self) self.num = num def run(self): print("I am", self.num)t1 = newThread(1)t1.start()第二种:
__author__ = 'LL_YING'import threading# 使用threading.Thread直接在线程中运行函数def run(x, y): for i in range(x, y): print(i)t1 = threading.Thread(target=run, args=(15, 20)) # 直接使用Thread附加函数,args为参数t1.start()
0 0
- Python线程的两种创建方法
- Java创建线程的两种方法
- Java创建线程的两种方法
- Java创建线程的两种方法
- java线程的两种创建方法
- Java创建线程的两种方法
- java 创建线程的两种方法
- java---------创建线程的两种方法
- Java创建线程的两种方法
- Java线程创建的两种方法
- 线程创建的两种方法
- Java创建线程的两种方法
- Java 创建线程的两种方法
- Java 创建线程的两种方法
- 创建线程的两种常用方法
- Java创建线程的两种方法
- Java 创建线程的两种方法
- 创建线程的两种方法
- EL
- 比较完整的c3p0配置
- POJ 3237 树链剖分学习(&&树链剖分小结)
- Android UI之Gallery和ImageSwitcher
- uva 816 - Abbott's Revenge(bfs)
- Python线程的两种创建方法
- iOS-开发记录-UIView属性
- inch,mil,mm,0402,0603,0805
- 类继承的各种方式
- uva 1364 - Knights of the Round Table(二分图+强连通)
- 绘图与动画之使用CAKeyframeAnimation实现仿WP水滴加载动画
- 第十一章,图像处理和文本认证
- Hello world!
- void和void*详解