码迷,mamicode.com
首页 >  
搜索关键字:threading    ( 3244个结果
20190127 daily blog
今天主要学习了python中的IO和多线程。IO和java中类似,分为字符流和字节流。关键字with可以简化try except这样的写法。 其次是python中的进程和线程。一个任务就是一个进程,进程中的子任务称为线程。python多线程的用法和java类似,关键的类是threading,调用方式 ...
分类:其他好文   时间:2019-01-28 10:50:09    阅读次数:164
Python线程Event例子 (Boss要求等待员工生产杯子例子)
threading Event例子
分类:编程语言   时间:2019-01-27 16:37:51    阅读次数:136
python3之threading模块(下)
同步线程 threading.Condition(),Condition使用了一个Lock,所以可以绑定一个共享资源,使多个线程等待这个资源的更新再启动。 当然Condition也可以显示地使用acquire()和release()方法。 一个简单的示例 1: import logging 2: i... ...
分类:编程语言   时间:2019-01-26 15:54:52    阅读次数:174
python3之threading模块(中)
派生线程 简单的示例 1: import threading 2: import logging 3: 4: class Mythread(threading.Thread): 5: def run(self): 6: logging.debug("running") 7: logging.basi... ...
分类:编程语言   时间:2019-01-26 11:20:47    阅读次数:229
C#字典Dictionay多线程读是否是安全的
答案:是线程安全的,只读不写多线程下,完全不需要加锁! 测试代码: 模拟5万个线程读字典,看看是否混乱: 完全不需要担心,放心 ...
分类:编程语言   时间:2019-01-25 23:20:43    阅读次数:285
python3之threading模块(上)
threading模块提供了管理多个线程执行的API。 最简单的用法。就是用一个目标函数实例化一个Thread对象。start()开始工作,join()等待当前线程完成。 1: import threading 2: def work(): 3: print("working") 4: for i ... ...
分类:编程语言   时间:2019-01-25 19:20:53    阅读次数:213
python 线程
import time import threading def task_thread(counter): print(f'线程名称:{threading.current_thread().name} 参数:{counter} 开始时间:{time.strftime("%Y-%m-%d %H:%M... ...
分类:编程语言   时间:2019-01-24 21:57:17    阅读次数:245
事件 event
from threading import Thread,Event from multiprocessing import Process,Event e = Event()#将事件实例化 e.set() 将Event 的状态改为True e.clear() 将Event的状态改为FALSE e. ...
分类:其他好文   时间:2019-01-24 19:29:07    阅读次数:145
进程池和线程池 concurrent.futures import ProcessPoolExecutor,ThreadPoolExecutor
import time#线程池可以用shutdown submit from threading import current_thread from concurrent.futures import ThreadPoolExecutor,ProcessPoolExecutor def f1(n) ...
分类:编程语言   时间:2019-01-24 19:26:50    阅读次数:531
Python常见的库
常见的库string:字符串处理re:正则表达式os:操作系统接口pdb:调试库time:时间(datetime)logging:日志urllib:web处理sys:系统库threading:多线程库http:http服务MySQLdb:访问mysqldbpyHook:hook键盘鼠标<监控鼠标键盘>pycurl:curl的python版xlrd/xlwt:处理excel表格pyexp
分类:编程语言   时间:2019-01-24 14:28:32    阅读次数:184
3244条   上一页 1 ... 63 64 65 66 67 ... 325 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!