删除文件夹下的所有文件
2018-12-17 本文已影响0人
LittleJessy
CUR_PATH = r'D:\python_web_pro\QAPlatform\jlc_test_mgmt\upload\process_excel'
# 删除文件夹下所有内容
def rm_file(path):
ls = os.listdir(path)
print("===============ls:",ls)
for i in ls:
c_path = os.path.join(path,i)
print("===============c_path:", c_path)
if os.path.isdir(c_path):
rm_file(c_path)
else:
os.remove(c_path)
rm_file(CUR_PATH)