Python批量删除指定目录下的指定类型的文件
2016-01-08 13:05
926 查看
Python作为一种脚本语言。其很适合文件级的各种操作。以下的代码能够批量删除指定目录下的所有特定类型(CSV类型)的文件。
import sys, csv , operator import os import glob for i in range(0, 20): path = "C:\\Python34\\Folder_" + str(i) for infile in glob.glob( os.path.join(path, '*.csv') ): os.remove(infile)
相关文章推荐
- 22. Generate Parentheses leetcode Python 2016 new Season
- python-ldap
- 菜鸟学python(2) 常见运算符
- 21. Merge Two Sorted Lists leetcode Python 2016 new Season
- python的argv最简单的用法
- python包的概念
- Python脚本运行出现语法错误:IndentationError: unindent does not match any outer indentation level
- python获取知乎日报另存为txt文件
- python抓取网页过程
- python多进程web服务器新思路
- Python/C API 异常处理
- python辅助开发模块(非官方)如pil,mysqldb,openpyxl,xlrd,xlwd
- python辅助开发模块(非官方)如pil,mysqldb,openpyxl,xlrd,xlwd
- python None与Null
- Python环境搭建之Python+Wing IDE开发环境配置
- Python Numpy数组保存
- Installing OpenCV for Python on Ubuntu, getting ImportError: No module named cv2.cv
- Python中的操作符重载
- python2 和Python3的区别
- 让正则表达式变简单(PythonVerbalExpressions)