Python 判断文件是否存在,存在则删除时间:2025-02-27 11:03:10# filepath为文件路径 import os # 判断文件是否存在 if (os.path.exists(filepath)) : #存在,则删除文件 os.remove(filepath)