ÓÃ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 ѧϰ]2.5°æyield֮ѧϰÐĵÃ
ÔÚ shhgs ·¢²¼Á˹ØÓÚ¡¶ Py 2.5 what's new Ö® yield¡·Ö®ºó£¬ÔÀ´ÎÒ²»ÊÇÌØ±ð¹Ø×¢ yield µÄÓ÷¨£¬ÒòΪ¶ÔÓÚ2.3ÖмÓÈëµÄyieldÏà¶ÔÀ´Ëµ¹¦Äܼòµ¥£¬ËüÊÇ×÷Ϊһ¸ö generator ²»¿ÉȱÉÙµÄÒ»ÌõÓï¾ä£¬Ö»Òª°üº¬ËüµÄº¯Êý¼´ÊÇÒ»¸ö generator ¡£µ«ÔÚ2.3ÖУ¬generator ²»ÄÜÖØÈ룬²»ÄÜÔÚÔËÐй ......
ת×Ô http://hi.baidu.com/xunxun129/blog/item/3befad0f8ff992c07bcbe180.html
ÓÐʱÎÒÃÇÐèÒªÔÚ Python
ÖÐʹÓà zip Îļþ£¬¶øÔÚ1.6°æÖУ¬Python ¾ÍÒѾÌṩÁË zipfile Ä£¿é¿ÉÒÔ½øÐÐÕâÑùµÄ²Ù×÷¡£²»¹ý Python ÖеÄ
zipfile Ä£¿é²»ÄÜ´¦Àí¶à¾íµÄÇé¿ö£¬²»¹ýÕâÖÖÇé¿ö²¢²»¶à¼û£¬Òò´ËÔÚͨ³£Çé¿öÏÂÒѾ×㹻ʹÓÃÁË¡£ÏÂÃæÎÒÖ»Ê ......
#!/usr/bin/env python
# -*-coding:UTF-8-*-#ÕâÒ»¾ä¸æËßpythonÓÃUTF-8±àÂë
#=========================================================================
#
# NAME: Python MySQL test
#
# AUTHOR: benyur
# DATE : 2004-12-28
#
# COMMENT: ÕâÊÇÒ»¸öpythonÁ¬½ÓmysqlµÄÀý×Ó
#
#================ ......
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 ......
PyRSS2Gen £ºrssÉú³É
ÏÂÔØµØÖ·£ºhttp://www.dalkescientific.com/Python/PyRSS2Gen-1.0.0.tar.gz
Àý×Ó£º
Java´úÂë
import datetime
import PyRSS2Gen
rss = PyRSS2Gen.RSS2(
title = " ......