选择频道搜索
可以使用os.path.exists()函数来判断路径是否存在。该函数返回一个布尔值,如果路径存在则返回True,否则返回False。
os.path.exists()
示例代码:
import ospath = "/path/to/file"if os.path.exists(path): print("路径存在")else: print("路径不存在")