def delete_dire(dire):
dir_list = []
for root, dirs, files in os.walk(dire):
for afile in files:
os.remove(os.path.join(root, afile))
for adir in dirs:
dir_list.append(os.path.join(root, adir))
for bdir in dir_list:
os.rmdir(bdir)
原文地址:https://www.cnblogs.com/dengtou/p/9831674.html
时间: 2024-11-10 01:26:15