delete the files in subfolders

import os
from os import walk
import shutil

mypath='./13/'
for (dirpath, dirnames, filenames) in walk(mypath): for dir in dirnames: for (dirpath1, dirnames1, filenames1) in walk(mypath+dir): for i in filenames1: print(mypath+dir+'/'+i) os.remove(mypath+dir+'/'+i)

http://blog.csdn.net/liuchunming033/article/details/39400931  

posted on 2018-01-24 01:13  cdekelon  阅读(165)  评论(0编辑  收藏  举报

导航