# FilesBatchRename.py
# 导入os库
import os
# 图片存放的路径
path = r"D:/temp"
# 遍历更改文件名
num = 1
for file in os.listdir(path):
os.rename(os.path.join(path,file),os.path.join(path,str(num))+".jpg")
num = num + 1
文章来源
评论可见,请评论后查看内容,谢谢!!!评论后请刷新页面。
# FilesBatchRename.py
# 导入os库
import os
# 图片存放的路径
path = r"D:/temp"
# 遍历更改文件名
num = 1
for file in os.listdir(path):
os.rename(os.path.join(path,file),os.path.join(path,str(num))+".jpg")
num = num + 1
文章来源
本文由 用户 于 2024-05-20 发布在 夸智网,如有疑问,请联系我们。
本文链接:https://www.kuazhi.com/post/712958660.html
发表评论