随笔分类 - python script
common functional tool
摘要:def test_variable_forin(): alist = ['a', 'bb', 'cc', 'dd'] count = 0 for i in alist: print i count += 1 if len(i) > 1: ...
阅读全文
摘要:'''Created on Jan 28, 2013@author: changxue@summary: to look for a file by filename within specified directory, or look for some word in files'''import osimport sysdef search_file(key, scope): for parent, dirs, files in os.walk(scope): if key in files: print parent, ...
阅读全文
摘要:'''Created on Feb 6, 2013@author: changxue@summary: to delete all files and directories in specified directory. print the name of file or directory if it can't remove.'''import os, sysdef clean(path): # to deal with abnormal situation if not os.path.exists(path): raise Ex
阅读全文

浙公网安备 33010602011771号