python 判断某文件是否存在

判断某文件是否存在 os.path.exists(file_path)

删除某文件: os.remove(file_path)

import os

file_path="d:/mk.txt"

if os.path.exists(file_path)==True:
    os.remove(file_path)

猜你喜欢

转载自blog.csdn.net/qq_35577990/article/details/89813523