python3tkinter图形化界面删除空文件

编程

python"># coding=utf-8

from tkinter import *

import os

import time

def printInfo():

for root, dirs, files in os.walk(entry1.get(), topdown=0):

for name in dirs:

dirname = os.path.join(root, name)

if not os.listdir(dirname):

print("删除 " + dirname)

os.rmdir(dirname)

item = dirname + " deleted"

list1.insert(0, item)

list1.insert(0, time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()))

myWindow = Tk()

myWindow.title("空目录清理")

Label(myWindow, text="输入目录:").place(x=10, y=10)

entry1 = Entry(myWindow, relief=SOLID)

entry1.place(x=10, y=50, width=380)

Button(myWindow, text="RUN", command=printInfo, relief=GROOVE).place(x=10, y=80)

myWindow.geometry("400x500")

list1 = Listbox(myWindow, relief=SOLID)

list1.place(x=10, y=120, width=380,height=350)

myWindow.mainloop()

 

以上是 python3tkinter图形化界面删除空文件 的全部内容, 来源链接: utcz.com/z/518098.html

回到顶部