批量删除文件,,# -*- coding


# -*- coding: utf8 -*-  '''Created on 2012-9-10@author: tangyao'''import osdef delfile(paths):    if os.path.isfile(paths):        try:            os.remove(paths)        except:            pass    elif os.path.isdir(paths):        for file in os.listdir(paths):           # print itemf            subpath=os.path.join(paths,file)          #  print subpath            delfile(subpath)        try:            os.rmdir(paths)        except:            passprint os.getcwd()#该片段来自于http://byrx.net

评论关闭