1 Star 0 Fork 0

oceanwave/shuowen_spider

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
image_crop.py 787 Bytes
一键复制 编辑 原始数据 按行查看 历史
liuyanan 提交于 2016-02-15 14:57 . 删除了冗余的图片
# -*- coding: utf-8 -*-
'''
Created on Jan 28, 2016
@author: liuyanan
'''
import os
# folder_path = '/Users/liuyanan/my_work/Eclipse_Space/shuowen_spider.git'
folder_path = os.path.split(os.path.realpath(__file__))[0]
for parent, dirnames, filenames in os.walk(folder_path):
for filename in filenames:
if filename.endswith('.png') and '-0'in filename:
file_path = os.path.join(parent, filename)
new_file_path = os.path.join(parent, filename.replace('-0', ''))
# cmd = "convert %s -crop 110x110 %s" % (file_path, file_path)
# cmd = 'rm -rf %s' % file_path
# new_filename = filename.replace('-0', '')
cmd = 'mv %s %s' % (file_path, new_file_path)
os.system(cmd)
print filename
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/oceanwave/shuowen_spider.git
git@gitee.com:oceanwave/shuowen_spider.git
oceanwave
shuowen_spider
shuowen_spider
master

搜索帮助