python批量重命名
作者:互联网
import os,sys
path = "D:/ps-pdf2/"
# 获取该目录下所有文件,存入列表中
fileList = os.listdir(path)
n=11
while n<99 :
oldname = "PyQt5快速开发与实战电子书-" + str(n + 1) + ".jpg"
newname = "PyQt5快速开发与实战电子书-" + "0" + str(n + 1) + ".jpg"
oldname2 = path + oldname
newname2 = path + newname
os.rename(oldname2, newname2)
print(oldname2, newname2)
n+=1
标签:重命名,批量,python,oldname2,PyQt5,oldname,newname2,path,os 来源: https://www.cnblogs.com/ricksteves/p/15027779.html