python的强大的原因就是有很多非常实用的模块。今天用到了一个读取文件内容的小模块,做个记录:
#!/usr/bin/python # -*- coding: utf-8 -*- import os, glob path = 'XXX' for infile in glob.glob(os.path.join(path, '*.png')): print infile print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>") for infile in sorted(glob.glob(os.path.join(path, '*.png'))): print infile print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>") for infile in sorted(glob.glob(os.path.join(path, '*.png')),key=os.path.getmtime): print infile
print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>") for infile in sorted(glob.glob(os.path.join(path, '*.png')),key=os.path.getsize): print infile
作者:虚生 出处:https://www.cnblogs.com/dylancao/ 以音频和传感器算法为核心的智能可穿戴产品解决方案提供商 ,提供可穿戴智能软硬件解决方案的设计,开发和咨询服务。 勾搭热线:邮箱:1173496664@qq.com weixin:18019245820 市场技术对接群:347609188 |