易截截图软件、单文件、免安装、纯绿色、仅160KB

[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


相关文档:

Python快速入门

1. 第一章 Python快速入门
本章是Python的快速入门,在这一章并不涉及python的特殊规则和细节,目标是通过示例使你快速了解Python语言的特点。本章简要介绍了变量,表达式,控制流,函数以及输入/输出的基本概念,在这一章不涉及Python语言的高级特性。尽管如此,有经验的程序员还是能够通过阅读本章的材料创建高级程序。我们 ......

网络校时 附Python源码及几个标准时间服务器

网络时间服务器 一般都遵循 RFC868 协议标准.
按该标准 附下面 Python 源码.
# -*- coding: utf-8 -*-
import socket,sys,time
#时间服务器
host = "stdtime.gov.hk"
#端口
port = 37
#时区
curtz = 8
#连接服务器,并接收返回
try:
host = socket.gethostbyname(host)
s = socket.socket(socket.AF_INET,soc ......

python中MySQLdb的简单使用

对数据库的操作基本分为三步:
 
连接数据库
根据需要执行SQL语句,接受返回值
关闭连接
我们正常的数据库应该都离不开这三步,下来说说如何使用python中的MySQLdb模块进行这些操作:
首先,我们需要把MySQLdb引入到程序中
 
import MySQLdb
 
然后开始数据库操作
1.数据库连接
conn = MySQLdb. ......

Python 中列出目录中所有文件的方法


Python代码
import string, os, sys   
  
dir = '/var'  
print '----------- no sub dir'  
  
files = os.listdir(dir)   
for f in files:   
   ......

用python连接mysql数据库


#
-*- encoding: gb2312 -*-
import
os, sys, string
import
MySQLdb
#
连接数据库
try
:
conn
=
MySQLdb.connect(host
=
'
localhost
'
,user
=
'
root
'
,passwd
=
'
xxxx
'
,db
=
'
test1
'
)
except
Exception, e:
print
e
sys.exit()
......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号