python os.path模塊
摘要: os和os.path模塊
os.listdir(dirname):列出dirname下的目錄和文件
os.getcwd():獲得當前工作目錄
os.curdir:返回但前目錄('.')
os.chdir(dirname):改變工作目錄到dirname
os.path.isdir(name):判斷name是不是一個目錄,name不是目錄就返回false
os.path.isfile(name):判斷name是不是一個文件,不存在name也返回false
os.path.exists(name):判斷是否存在文件或目錄name
os.path.getsize(name):獲得文件大小,如果name是目錄返回0L
os.path.abspath(name):獲得絕對路徑
os.path.normpath(path):規范path字符串形式
os.path.split(name):分割文件名與目錄(事實上,如果你完全使用目錄,它也會將最后一個目錄作為文件名而分離,同時它不會判斷文件或目錄是否存在)
閱讀全文
posted @
2012-05-03 00:10 -274°C 閱讀(1711) |
評論 (1) 編輯
python urllib2.urlopen 簡單范例
摘要: 發現手邊有個python 寫來做測試HTTP的小腳本,還是發出來。很簡單,很方便。
閱讀全文
posted @
2011-11-23 01:26 -274°C 閱讀(3862) |
評論 (0) 編輯
python 解析xml (dom)
摘要: 這里只是寫了dom的簡單使用。日后用到更復雜的應用的時候再補充。
閱讀全文
posted @
2008-04-11 14:51 -274°C|
編輯