python判断文件和文件夹是否存在 2009-07-02 10:49 import osos.path.isfile('test.txt') #如果不存在就返回Falseos.path.exists(directory) #如果目录不存在就返回False