摘要:
os.walk(top) =>this method is acceptable with a valid path, and return a tuple,which consists of 3 elements being path string of path name,list of dictionary name, and list of file name everytime goint through with this pass down path. it would be empty ifno path/pathname/filename is there1 impor 阅读全文
posted @ 2013-12-28 22:51
Yu Zi
阅读(1293)
评论(0)
推荐(0)
摘要:
sys.argv1 import sys2 def parse_args():3 for arg in sys.argv[1:]:4 print arggetopt 1 import sys 2 import getopt 3 def test_getopt(): 4 """ 5 'Usage:test.py [-a|-b|-h|-A|-B|-H] args 6 """ 7 try: 8 ''' 9 getopt(args, shortopts, longopts=[])10 args: T... 阅读全文
posted @ 2013-12-28 17:28
Yu Zi
阅读(929)
评论(0)
推荐(0)
摘要:
Source code is as below: 1 def func(*args,**kwargs): 2 print 'args=',args 3 print 'kwargs=',kwargs 4 print '_'*30 5 6 def main(): 7 func(1,2,3,4) 8 func(a=1,b=2,c=3) 9 func(1,2,3,4,a=1,b=2,c=3)10 func('a',1,None,a=1,b='2',c=3)11 12 if __name__=='__main__ 阅读全文
posted @ 2013-12-28 15:01
Yu Zi
阅读(355)
评论(0)
推荐(0)
摘要:
1)>>> import time>>> ISOTIMEFORMAT='%Y-%m-%d %X'>>> print time.strftime(ISOTIMEFORMAT,time.localtime())2013-12-28 14:00:17>>> import datetime>>> print datetime.datetime.now()2013-12-30 15:41:43.8900002)>>> def getTime():from datetime impo 阅读全文
posted @ 2013-12-28 14:18
Yu Zi
阅读(315)
评论(0)
推荐(0)
浙公网安备 33010602011771号