[Python module] threading
threading — Higher-level threading interface
This module constructs higher-level threading interfaces on top of the lower level _thread module. See also the queue module.
The dummy_threading module is provided for situations where threading cannot be used because _thread is missing.
这个模块是构建在底层_thread模块上的。
dummy_threading模块提供了可threading(由于_thread缺失)模块不能使用的情况。
Note
While they are not listed below, the camelCase names used for some methods and functions in this module in the Python 2.x series are still supported by this module.
This module defines the following functions and objects:
threading.active_count() Return the number of Thread objects currently alive. The returned count is equal to the length of the list returned by enumerate().
threading.Condition() A factory function that returns a new condition variable object. A condition variable allows one or more threads to wait until they are notified by another thread.threading.current_thread() Return the current Thread object, corresponding to the caller’s thread of control. If the caller’s thread of control was not created through the threading module, a dummy thread object with limited functionality is returned.threading.enumerate() Return a list of all Thread objects currently alive. The list includes daemonic threads, dummy thread objects created by current_thread(), and the main thread. It excludes terminated threads and threads that have not yet been started.threading.Event() A factory function that returns a new event object. An event manages a flag that can be set to true with the set() method and reset to false with the clear() method. The wait() method blocks until the flag is true.class threading.local
A class that represents thread-local data. Thread-local data are data whose values are thread specific. To manage thread-local data, just create an instance of local (or a subclass) and store attributes on it:
mydata = threadi
相关文档:
综述
多线程是程序设计中的一个重要方面,尤其是在服务器Deamon程序方面。无论何种系统,线程调度的开销都比传统的进程要快得多。
Python可以方便地支持多线程。可以快速创建线程、互斥锁、信号量等等元素,支持线程读写同步互斥。美中不足的是,Python的运行在Python
虚拟机上,创建的多线程可 ......
Python 3 是 Guido van Rossum 功能强大的通用编程语言的最新版本。它虽然打破了与 2.x 版本的向后兼容性,但却清理了某些语法方面的问题。本文是系列文章中的第一篇,介绍了影响该语言及向后兼容性的各种变化,并且还提供了新特性的几个例子。
Python 版本 3,也被称为 Python 3000 或 Py3K(仿效 Microsoft® Windows ......
python 中的re 模块
正则表达式
就个人而言,主要用它来做一些复杂字符串分析,提取想要的信息
学习原则:够用就行,需要的时候在深入
现总结如下:
正则表达式中特殊的符号:
“.” 表任意字符
“^ ” 表string起始
“$” 表string 结束
“*” “+” & ......
真是倒霉,刚买不久的移动硬盘,昨天删除一个分区失败后,几个分区都不见了,拿去修,未果
换了个新的,但其中数据全没了。那是我平时收集的很有用的资料
很多都可以重新下载,但怎能想起硬盘中的所有东西
今天换硬盘回来
就像写一个保存指定路径下所有文件夹和文件名的程序
这样,如果东西丢了,看看那里有些什么,也 ......
闲来无事, 玩玩python...
是采用有道翻译, 然后抓取网页的.
import re, urllib
url="http://dict.youdao.com/search?le=eng&q="
print ("input q to exit")
while 1:
word = raw_input(">>>")
if word=="q":
exit()
else:
word = word.replace(' ', '+')
url += word
u ......