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