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

ÓÃ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ÖÐÊäÈëµÄÃüÁîÐвÎÊý


Ïà¹ØÎĵµ£º

pythonѧϰ

 4¡¢Tuples Ôª×é
     Ôª×éºÍListsÏàËÆ£¬µ«ËüÊÇimmutable,³õʼ»¯ºó²»ÄܸıäÆäÄÚÈÝ£¬ÕâÔÚ³ÌÐòÖÐÓÐʱºòºÜÓÐÓ㬿ÉÒÔÓÃÀ´·ÀÖ¹¶¨ÒåµÄ±äÁ¿ÄÚÈݱ»ÒâÍâ¸Ä±ä¡£
5¡¢Files Îļþ
    Îļþ²Ù×÷ºÍcÓïÑԱȽϽӽü£¬ÏÂÃæÖ»Í¨¹ý´úÂëÑÝʾ£º
>>> f = open('data.txt','w')
>>> ......

Python 3.x (1):ÈëÃÅ

 
1 ÄãºÃ
#´ò¿ªÐ´°¿Ú,ÊäÈë:
#! /usr/bin/python
# -*- coding: utf8 -*- 
s1=input("Input your name:")
print("ÄãºÃ,%s" % s1)
'''
֪ʶµã:
    * input("ij×Ö·û´®")º¯Êý:ÏÔʾ"ij×Ö·û´®",²¢µÈ´ýÓû§ÊäÈë.
    ......

PythonÖеĶÔÏó¡¢±äÁ¿¼°ÒýÓÃ

  ÔÚPythonÖУ¬ÎÒÃÇÖ´Ðбí´ïʽ a = 3£¬Python»áÔõÑù²Ù×÷ÄØ£¿
1¡¢Ê×ÏȻᴴ½¨Ò»¸ö¶ÔÏó±íʾֵ3
2¡¢Èç¹û±äÁ¿a²»´æÔÚ£¬´´½¨±äÁ¿a
3¡¢°Ñ±äÁ¿aÁ¬½Óµ½±íʾ3µÄ¶ÔÏó
ÔÚPythonÖУ¬±äÁ¿ºÍ¶ÔÏó´æ´¢ÔÚ²»Í¬µÄµØ·½£¬Í¨¹ýÖ¸ÕëÁ¬½ÓÆðÀ´...
Ò»¸ö±äÁ¿×ÜÊǺͶÔÏóÁ¬½ÓÆðÀ´£¬²»´æÔÚ²»ºÍ¶ÔÏóÁ¬½ÓµÄ±äÁ¿£¬µ«ÊÇ´óµÄ¶ÔÏó¿ÉÄÜÁ¬½Óµ½±ðµÄ¶ÔÏó¡£ ......

Python Ö®ìø

import this
The Zen of Python, by Tim Peters
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough t ......

Andorid»·¾³Python±à³Ì

 http://code.google.com/p/android-scripting/
Android¿ªÊ¼Ö§³Ö½Å±¾ÓïÑÔPython¡¢Lua¼°Beanshell£¬Î´À´»¹½«Ö§³ÖRuby
×÷Õß Werner Schuster ÒëÕß ÕÅÁú ·¢²¼ÓÚ 2009Äê7ÔÂ5ÈÕ
Android Scripting Environment£¨ASE£©ÏîĿΪAndroidÔö¼ÓÁ˽ű¾Ö§³Ö¡£Í¨¹ý°²×°ASE£¬ÎÒÃÇ¿ÉÒÔÔÚÉ豸Éϱàд½Å±¾²¢Ö´ÐС£
ËäÈ»ÏÖÔÚÒѾ­Ó¿ÏÖ³öÁ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ