python socket server ²¢·¢£¨×ª£©
import SocketServer, time, select, sys
from threading import Thread
COMMAND_HELLO = 1
COMMAND_QUIT = 2
# The SimpleRequestHandler class uses this to parse command lines.
class SimpleCommandProcessor:
def __init__(self):
pass
def process(self, line, request):
"""Process a command"""
args = line.split(' ')
command = args[0].lower()
args = args[1:]
if command == 'hello':
request.send('HELLO TO YOU TO!\n\r')
return COMMAND_HELLO
elif command == 'quit':
request.send('OK, SEE YOU LATER\n\r')
return COMMAND_QUIT
else:
request.send('Unknown command: "%s"\n\r' % command)
# SimpleServer extends the TCPServer, using the threading mix in
# to create a new thread for every request.
class SimpleServer(SocketServer.ThreadingMixIn, SocketServer.TCPServer):
# This means the main server will not do the equivalent of a
# pthread_join() on the new threads. With this set, Ctrl-C will
# kill the server reliably.
daemon_threads = True
# By setting this we allow the server to re-bind to the address by
# setting SO_REUSEADDR, meaning you don't have to wait for
# timeouts when you kill the server and the sockets don't get
 
Ïà¹ØÎĵµ£º
ʹÓÃpdbµ÷ÊÔPython³ÌÐò
±¾ÎÄÌÖÂÛÔÚûÓз½±ãµÄIDE¹¤¾ß¿ÉÓõÄÇé¿öÏ£¬Ê¹ÓÃpdbµ÷ÊÔpython³ÌÐò
Ô´ÂëÀý×Ó
ÀýÈ磬ÓÐÄ£ÄâË°ÊÕ¼ÆËãµÄ³ÌÐò£º
#!/usr/bin/python
def debug_demo(val):
if val &l ......
from http://blog.alexa-pro.cn/?p=315
´ËÎĵµÊ¹ÓÃƽ̨Ϊ cPAMIE Build 2.0,ºÍ֮ǰµÄ°æ±¾ÓÐÃ÷ÏԵIJî±ð,¾ßÌå¿ÉÖ±½Ó¿´cPAMIE.py Ô´Âë
ÏÂÃæÊÇһЩ³£Óõķ½·¨
ie.navigate('http://blog.alexa.cn') ÓÃÀ´·ÃÎÊÒ»¸öÁ´½Ó¡£
ie.linkClick('linkname') ´ò¿ªÕâ¸öÒ³ÃæÖеÄÒ»¸öÁ¬½Ó ²ÎÊý: name»ò id
ie.textBoxSet('labels','python ......
python 2.4ÖÐdatetimeÓÐstrftime·½·¨¶øÎÞstrptime·½·¨
¶øpython2.5ÖÐÕâÁ½¸ö·½·¨¾ùÓУ¬¶øÎҵĿª·¢»·¾³ÕýºÃÊÇpython 2.5£¬¶øÔËÐл·¾³ÔòÊÇpython 2.4
¿ª·¢»·¾³Ïµ÷ÊԺõijÌÐò£¬ÔÚ·þÎñÆ÷ÉϾͲ»run¡£²éÁËÒ»ÏÂpythonµÄ¹Ù·½Îĵµ
£¬Ð±Ìåд×Å£ºNew
in version 2.5.
²»¼æÈݵĴúÂëÈçÏ£º
PythonÓïÑÔ
:
test_strptime.py
res ......
from link http://www.tt010.net/cms/show_article/1057.html
·¢±íÆÀÂÛ
Post by : BossAdmin @[2009-12-12 17:11:20] views:115
adodb£ºÎÒÃÇÁìµ¼ÍƼöµÄÊý¾Ý¿âÁ¬½Ó×é¼þ
bsddb3£ºBerkeleyDBµÄÁ¬½Ó×é¼þ
Cheetah-1.0£ºÎұȽÏϲ»¶Õâ¸ö°æ±¾µÄcheetah
cherrypy£ºÒ»¸öWEB framework
ctypes£ºÓÃÀ´µ÷Óö¯Ì¬Á´½Ó¿â
DBUtils£ºÊý ......
ãÂ㶮¶®µÄ°²×°ÁËPython£¬²»Îª±ðµÄ£¬Ö»Îª¸Ïµãʱ÷Ö£¬ÒòΪ¿´¼ûºÜ¶àÓÎÏ·¹«Ë¾¶¼ÒªÇó»áÒ»µãPython»òÕßLUA£¬Ã»°ì·¨£¬»¹ÊǶàѧһµãºÃ£¬·´ÕýÏÐ×ÅÒ²ÊÇÏÐ×Å¡£×Ô¼ºÄ¿Ç°²»¶®LINUX£¬ËùÒÔÔÝÇÒÓÃÓÃWINDOWSϵİɡ£
ÈëÃÅ»¹ºÃÈëÊÖ£¬²»ÊǾÞÄÑ£¬Ö¸³ö¼¸µãÓÐÒâ˼µÄ£º
ûÓлù±¾ÀàÐÍÁË£¬µ±ÎÒ°²cÓïÑÔÓ﷨дint xÊ ......