Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

[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


Ïà¹ØÎĵµ£º

PYTHON½Ì³Ì [Symbian]

Ò»¡¢pythonÊÇʲô£¿
Æäʵ£¬python¾ÍÊÇÒ»Ãűà³ÌÓïÑÔ£¬¾ÍÏñjavaÒ»Ñù¡£±¾À´ÊÇÔÚµçÄÔÉϵ쬵«ÊÇËæ×ÅÊÖ»úµÄÁ÷ÐУ¬python±»ÒÆÖ²µ½ÁËÊÖ»úÉÏ£¬Í¬Ê±Ò²±»ÃüÃûΪpyS60¡£
¶þ¡¢pyÈí¼þµÄ¹¹Ôì
ËùÓеÄpyÈí¼þ¶¼Òª°üÀ¨ÈçÏÂÎļþ£º.app--1.65k£».rsc--337b£».aif¡£ÕâÈý¸öÎļþÔÚËùÓÐpyÈí¼þÖж¼ÊÇÏàͬµÄ£¬Î¨Ò»µÄÇø±ð¾ÍÊÇÈí¼þµÄuid²»Í¬¡£ÕâЩÎļ ......

python Êý¾Ý¿â

def Start(self):
        if (self.conn == None) or (self.conn.State == 1):
            self.conn = win32com.client.Dispatch(r'ADODB.Connection')
          &n ......

Python ÖÐÁгöĿ¼ÖÐËùÓÐÎļþµÄ·½·¨


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

LinuxÏÂÓÃPYTHON²éÕÒͬÃû½ø³Ì

1.¿ÉÖ´ÐгÌÐò
os.system('pgrep %s > %s' % (process, output))
   pidfile = open("output", 'r')
   totalpid = len(pidfile.readlines())
   pidfile.close()
   if totalpid == 0 :
         &nbs ......

ÓÃ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ºÅ