http://blog.csdn.net/eddy_zheng/article/details/47312729
#coding=utf-8
'''
使用函数os.dirlist()读取文件夹内的文件名字
2015.08.06
'''
from os import listdir
#将文件夹内的文件名读进列表m
filepath='C:\Users\Administrator\Desktop\mycode\cv-python-day13'
filename_list=listdir(filepath)
h=[]
#可以同过简单后缀名判断,筛选出你所需要的文件(这里以.jpg为例)
for filename in filename_list:#依次读入列表中的内容
if filename[-3:]=='jpg':#将读取文件名字的后三个字符与'jpg'匹对
h.append(x)#如果是'jpg'文件就添加进列表h
print h
python读取相似文件并处理
最新推荐文章于 2023-11-13 16:04:28 发布