摘要: Github上有些项目的源码中包含了.pyc文件,这些字节编译的文件在运行时可以提高速度,但我主要用于阅读,不要他们。于是写了几行python代码来完成删除的功能,当然这段代码也很容易应用到其他文件类型。 1 import os 2 def del_file(dirpath, postfix): 3 ''' 4 删除包含指定后缀名的文件 5 包括子目录中的文件 6 ''' 7 os.chdir(dirpath) 8 for root, dirs, files in os.walk(os.getcwd()): 9 for file ... 阅读全文
posted @ 2013-08-27 20:15 Leonfocus 阅读(318) 评论(0) 推荐(0) 编辑