python判断文件目录是否存在

import os
os.path.isfile('test.txt')  # 如果不存在就返回False
os.path.exists(directory)  # 如果目录不存在就返回False

 

os.makedirs(targetDir)  
os.path.join(targetDir, file)
os.remove(targetFile)

 
posted @ 2014-03-21 21:25  emanlee  阅读(828)  评论(0编辑  收藏  举报