# -*- coding:utf8 -*-
import os
import shutil
class BatchRename():
'''
批量重命名文件夹中的图片文件
'''
def __init__(self):
self.path = 'E:/check/ff'
self.newpath = 'E:/check/ff1'
def tiqu(self):
filelist = os.listdir(self.path)
# print(filelist)
# total_num = len(filelist)
for file in filelist:
# print file
filedir = os.path.join(self.path, file)
# print filedir
(shotname, extension) = os.path.splitext(file)
# a = os.path.splitext(file)
b = shotname.split('-')[1]
# print(shotname)
if (int(b) % 15 == 1):
print (shotname)
# print(str(filedir))
shutil.copy(str(filedir), os.path.join(self.newpath, b+'.jpeg'))
if __name__ == '__main__':
demo = BatchRename()
demo.tiqu()
本文地址:https://blog.csdn.net/mndlgzzd/article/details/107356799
如对本文有疑问, 点击进行留言回复!!
Python笔记-UiSelector中resourceId定位方式
【3Dtiles】3Dmax模型处理为gltf和3dtiles,包含LOD效果
荐 用Django全栈开发——08. 使用AdminLTE开发前端登录页面
网友评论