一、代码: import os flag = os.path.exists(path) 二、说明: True == flag:路径的文件或者文件夹存在False == flag:路径的文件或者文件夹不存在