首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >Python文件批量改名

Python文件批量改名

作者头像
狼啸风云
修改于 2022-09-02 21:28:44
修改于 2022-09-02 21:28:44
1.8K0
举报
代码语言:javascript
复制
import os
rootimgs = 'D:\dataset\cityscapes\cityscape_voc_foggy\JPEGImages\\'
rootxmls = 'D:\dataset\cityscapes\cityscape_voc_foggy\Annotations\\'
allusedxmls = []
file_imgs = os.listdir(rootimgs)
file_xmls = os.listdir(rootxmls)
for file_xml in file_xmls:
    file_name = file_xml[:-4] + '_foggy_beta_0.005.xml'
    oldname = rootxmls + file_xml
    newname = rootxmls + file_name
    os.rename(oldname, newname)
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2020/07/13 ,如有侵权请联系 cloudcommunity@tencent.com 删除
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档