python 判断文件和文件夹是否存在

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

猜你喜欢

转载自blog.csdn.net/sinat_26871259/article/details/87860781