[Python module] select
16.1. select — Waiting for I/O completion¶
This module provides access to the select and poll functions available in most operating systems, epoll available on Linux 2.5+ and kqueue available on most BSD. Note that on Windows, it only works for sockets; on other operating systems, it also works for other file types (in particular, on Unix, it works on pipes). It cannot be used on regular files to determine whether a file has grown since it was last read.
The module defines the following:
Õâ¸öÄ£¿éÌṩ´ó¶àÊý²Ù×÷ϵͳµÄselectºÍpoll¹¦ÄÜ¡£ epollÔÚLinux2.5+¿ÉÓã¬kqueueÔòÓÃÓÚBSD¡£ÔÚwinodwsϵͳÉÏ£¬Ëü½öÓÃÓÚsocket£¬ÔÚÆäËûϵͳÏ£¬ËüÒ²¿ÉÒÔÓÃÓÚÆäËûÀàÐÍ£¨ÌرðÔÚ Unix Ï£¬Ëü»¹¿ÉÒÔÓÃÓÚ ¹ÜµÀ£©¡£Ëü²»ÄÜÓÃÀ´È·¶¨×Ô´ÓÉϴζÁÈ¡ÒÔºóÊÇ·ñÆÕͨÎļþÓÐËùÔö³¤¡£
exception select. error ¶ The exception raised when an error occurs. The accompanying value is a pair containing the numeric error code from errno and the corresponding string, as would be printed by the C function perror .
ÔÚ·¢Éú´íÎó½«Òý·¢Òì³£¡£accompanying Öµ°üº¬´íÎó´úÂëºÍ´íÎóÃèÊöÎı¾£¬ÓÃÓÚʹÓà C ³ÌÐò perror() ´òÓ¡¡£
select. epoll ( [ sizehint=-1 ] ) ¶ (Only supported on Linux 2.5.44 and newer.) Returns an edge polling object, which can be used as Edge or Level Triggered interface for I/O events; see section Edge and Level Trigger Polling (epoll) Objects below for the methods supported by epolling objects.
½ö½öÔÚLinux2.5.44ÒÔÉÏÖ§³Ö¡£
select. poll ( ) ¶ (Not supported by all operating systems.) Returns a polling object, which supports registering and unregistering file descriptors, and then polling them for I/O events; see section Polling Objects below for the methods supported by polling objects.
ËùÓÐϵͳ²»Ö§³Ö¡£
select. kqueue ( ) ¶ (Only supported on BSD.) Returns a kernel queue object object; see section Kqueue Objects below for the methods supported by kqueue objects.
½ö½öÖ§³ÖBSD¡£
select. kevent ( ident , filter=KQ_FILTER_READ , flags=KQ_ADD , fflags=0 , data=0 , udata=0 ) ¶ (Only suppor
Ïà¹ØÎĵµ£º
ÀµÓºƣ¨http://laiyonghao.com£©
½ñÌ죨2009Äê5ÔÂ31ÈÕ£© OurPNP.org ¸ãÁ˸ö¾Û»á»î¶¯£¬ÅªÁËÊ®¼¸¶þÊ®¸öÈËÔÚ¹ãÖݺ£Öé¹ã³¡µÄÌûá´ôÁËÎå¸öСʱ£¬´´ÏÂÁËÎÒÔÚ K ·¿´ôµÄ×ʱ¼ä¼Í¼¡£Ó¦ËûÃǵÄÑûÇ룬ÎÒ×öÁ˸öÌâΪ¡¶Óà python ¿ìËÙ´î½¨ÍøÓηþÎñÆ÷¡·µÄСÑݽ²£¬ÒòΪÄDZߵĵçÊÓ¾¹È»²»ÄܽӵçÄÔ£¬ËùÒÔ½²µÄʱºòûÓÐÄܹ»²ÎÕÕ PPT À´½²£¬¹Û ......
ÏÂÔØÁ˺ܶàѹËõÎļþ£¬¾ÍдÁËÒ»¸ö½Å±¾
ÔÚPythonÖÐʹÓÃwinrarÃüÁËùÒÔÒ»°ãѹËõÎļþ¶¼Ö§³Ö
ÓÐЩѹËõÎļþPythonÖл¹Ã»ÓÐÏàÓ¦µÄ¿â
ÄãµÃÏȰÑwinrarÌí¼Óµ½path»·¾³±äÁ¿ÖÐ
°Ñ´úÂë±£´æÎªrar.py
ÔÚdosÏÂʹÓã¬È磺rar.py "D:\A B\C" mkdir
#rar.py
#decompress with winrar
#arguments :filename directory opt
# op ......
Ò»¡¢pythonÊÇʲô£¿
Æäʵ£¬python¾ÍÊÇÒ»Ãűà³ÌÓïÑÔ£¬¾ÍÏñjavaÒ»Ñù¡£±¾À´ÊÇÔÚµçÄÔÉϵ쬵«ÊÇËæ×ÅÊÖ»úµÄÁ÷ÐУ¬python±»ÒÆÖ²µ½ÁËÊÖ»úÉÏ£¬Í¬Ê±Ò²±»ÃüÃûΪpyS60¡£
¶þ¡¢pyÈí¼þµÄ¹¹Ôì
ËùÓеÄpyÈí¼þ¶¼Òª°üÀ¨ÈçÏÂÎļþ£º.app--1.65k£».rsc--337b£».aif¡£ÕâÈý¸öÎļþÔÚËùÓÐpyÈí¼þÖж¼ÊÇÏàͬµÄ£¬Î¨Ò»µÄÇø±ð¾ÍÊÇÈí¼þµÄuid²»Í¬¡£ÕâЩÎļ ......
def Start(self):
if (self.conn == None) or (self.conn.State == 1):
self.conn = win32com.client.Dispatch(r'ADODB.Connection')
&n ......
PythonµÄosÄ£¿é£¬°üº¬ÁËÆÕ±éµÄ²Ù×÷ϵͳ¹¦ÄÜ£¬ÕâÀïÖ÷ҪѧϰÓë·¾¶Ïà¹ØµÄº¯Êý£º
os.listdir(dirname)£ºÁгödirnameϵÄĿ¼ºÍÎļþ
os.getcwd()£º»ñµÃµ±Ç°¹¤×÷Ŀ¼
os.curdir:·µ»Øµ±Ç°Ä¿Â¼£¨'.')
os.chdir(dirname):¸Ä±ä¹¤×÷Ŀ¼µ½dirname
os.path.isdir(name):ÅжÏnameÊDz»ÊÇÒ»¸öĿ¼£¬name²»ÊÇĿ¼¾Í·µ»Øfalse
......