python删除指定目录下的所有文件和目录代码
利用了os的remove还有递归函数调用:import os
import shutil
def del_file(path):if not os.listdir(path):print(目录为空!)else:for i in os.listdir(path):path_file os.path.join(path,i) #取文件绝对路径print(path_file)if os.path.isfile(path…
2026/7/19 9:44:23