ÓÃpythonµÄcmdÄ£¿éдһ¸ö¼òµ¥µÄshell
from cmd import *
class MyShell(Cmd):
def preloop(self):
print "print this line before entering the loop"
def postloop(self):
print "print this line after leaving the loop"
def precmd(self, line):
print "print this line before do a command"
return Cmd.precmd(self, line)
def postcmd(self, stop, line):
print "print this line after do a command"
return Cmd.postcmd(self, stop, line)
def do_test(self, line):
''' test command, just print the arguments except some special ones'''
if line == "exit":
exit()
else:
print line
MyShell().cmdloop()
#¼Ì³ÐcmdÄ£¿éµÄCmdÀàʵÏÖ
#shellÖеÄÃüÁîxxÔÚÀàÖжÔÓ¦µÄº¯ÊýÃûΪdo_xx
#lineÊÇshellÖÐÊäÈëµÄÃüÁîÐвÎÊý
Ïà¹ØÎĵµ£º
֮ǰѧϰµÚ¾ÅÕµÄÅÅÐòС½áµÄʱºò£¬¶Ôsort()ÅÅÐò·½·¨²»Àí½â£¬ÒòΪÀ¨ºÅÀïÃæ´øÁË×Ô¶¨ÒåµÄ±È½Ïº¯Êý¡£
ºóÀ´²éÊֲᣬ²Å·¢ÏÖsort()ÀïÃæ±¾À´¾Í´øÁËÕâÑùµÄ²ÎÊý¡£Äܹ»×Ô¶¨Òå±È½Ï·½·¨£¬È·ÊµºÜÁé»î¡£
²»½öÈç´Ë£¬ÔÚÍøÉϲ鵽һ¸ö²©¿Í£¬×÷Õß²»µ¥Í£ÁôÔÚÕâ±íÃæ£¬»¹²é¾¿ÁËsort()µÄÅÅÐòËã·¨£¬È·ÊµÓÐÒâ˼¡£
È«Îij¼ÈçÏ£º
http://blog.done ......
3. Dictionaries ×ÖµäÀàÐÍ
PythonÖУ¬×ÖµäÀàÐͲ¢²»ÊÇ˳ÐòÈÝÆ÷£¬¶øÀàËÆc++ÖеĹØÁªÈÝÆ÷(map)£¬DictionariesÖд洢µÄÊǼü/Öµ ¶Ô£¬ºÍmap²»Í¬µÄÊÇ£¬PythonµÄDictionariesÖпÉÒÔ´æÈÎÒâ¶ÔÏóÀàÐÍ¡£DictionariesÀàÐÍÒ²ÊǿɱäµÄ£¬ºÍListsÒ»Ñù£¬¿ÉÒÔÔµØÐ޸ģ¨Í¨¹ýϱêÐ޸ģ©¡£
ÏÂÃæÍ¨ ......
#!/usr/bin/env python
# -*-coding:UTF-8-*-#ÕâÒ»¾ä¸æËßpythonÓÃUTF-8±àÂë
#=========================================================================
#
# NAME: Python MySQL test
#
# AUTHOR: benyur
# DATE : 2004-12-28
#
# COMMENT: ÕâÊÇÒ»¸öpythonÁ¬½ÓmysqlµÄÀý×Ó
#
#================ ......
ת×Ô http://hi.baidu.com/xunxun129/blog/item/3befad0f8ff992c07bcbe180.html
ÓÐʱÎÒÃÇÐèÒªÔÚ Python ÖÐʹÓà zip Îļþ£¬¶øÔÚ1.6°æÖУ¬Python ¾ÍÒѾÌṩÁË zipfile Ä£¿é¿ÉÒÔ½øÐÐÕâÑùµÄ²Ù×÷¡£²»¹ý Python ÖÐµÄ zipfile Ä£¿é²»ÄÜ´¦Àí¶à¾íµÄÇé¿ö£¬²»¹ýÕâÖÖÇé¿ö²¢²»¶à¼û£¬Òò´ËÔÚͨ³£Çé¿öÏÂÒѾ×㹻ʹÓÃÁË¡£ÏÂÃæÎÒÖ»ÊÇ¶Ô ......
http://code.google.com/p/android-scripting/
Android¿ªÊ¼Ö§³Ö½Å±¾ÓïÑÔPython¡¢Lua¼°Beanshell£¬Î´À´»¹½«Ö§³ÖRuby
×÷Õß Werner Schuster ÒëÕß ÕÅÁú ·¢²¼ÓÚ 2009Äê7ÔÂ5ÈÕ
Android Scripting Environment£¨ASE£©ÏîĿΪAndroidÔö¼ÓÁ˽ű¾Ö§³Ö¡£Í¨¹ý°²×°ASE£¬ÎÒÃÇ¿ÉÒÔÔÚÉ豸Éϱàд½Å±¾²¢Ö´ÐС£
ËäÈ»ÏÖÔÚÒѾӿÏÖ³öÁ ......