import os |
import easygui as e |
def removeFile(path): |
if os.path.exists(path): |
os.remove(path) |
else : |
e.msgbox( "没有这个文件" ,title = 'ERORR' ) |
def insertFile(name): |
file = open ( 'C:\\Users\mikeKil\\Desktop\\' + name + ' .txt ',' w') |
file .close() |
x = e.integerbox( "方式([1 新建文件][2 删除文件]):" ,title = 'Doing' ) |
if x = = 1 : |
name = e.enterbox( "请输入你要新建的文件名称:" ,title = '输入你要新建的文件名' ) |
insertFile(name) |
elif x = = 2 : |
path = e.enterbox( "你要删除的文件路径:" ,title = '输入你要删除的文件路径' ) |
removeFile(path) |