import os
# import traceback
# os.system('start "" /d "C:\Windows" "regedit.exe"')
my_file = 'D:/hha.txt' # 文件路径
if os.path.exists(my_file): # 如果文件存在
#删除文件,可使用以下两种方法。
os.remove(my_file) # 则删除
#os.unlink(my_file)
else:
print('no such file:%s'%my_file)