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