挑选文件夹里面宽大于300图片,挑选文件夹300,需要用到PIL库impo
挑选文件夹里面宽大于300图片,挑选文件夹300,需要用到PIL库impo
需要用到PIL库
import sysimport ossys.path.append('PIL')from PIL import Image as impath = '/home/hualun/桌面/img/'new_path = '/home/hualun/桌面/img2/'for x in os.listdir(path): if x.endswith('.jpg'): file = im.open(path+x) width = file.size[0] if width > 300: os.rename(path+x, new_path+x) print "%s 移动完成.." % x
相关内容
- python 实现简单的SYSLOG服务器,并写入MYSQL数据库,sys
- 根据目录下的文件名生成SQL语句,文件名生成sql语句
- 自动生成 unity_build.cpp,unity_build.cpp,自动生成 unity_b
- 用Python做Port Forwarding,pythonforwarding,recipe-48373
- 解析xml文本,xml文本,[Python]代码#
- RSA算法的简单实现,RSA算法简单实现,[Python]代码#!
- 用python+PYQT4写的一个俄罗斯方块游戏,pythonpyqt4,[Pytho
- python实现DES加密算法,pythondes加密算法,[Python]代码
- python获得磁盘剩余空间 statvfs,pythonstatvfs,[Python]代码
- python写的群发邮件系统 有点瑕疵 为了大家讨论下~~~,
评论关闭