批量修改图片三位数编号python
时间: 2023-10-10 14:13:26 浏览: 94
批量修改图片的三位数编号可以使用Python来实现。首先,你需要将所有需要修改编号的图片放在同一个文件夹中。然后,可以使用以下代码来实现批量修改:
```python
import os
# 输入待修改文件夹路径
path = "E:/pyexe/exe/test/"
# 获取文件夹内所有文件,存入列表
f = os.listdir(path)
for i in f:
# 以点来分割文件名和扩展名
pre = i.split(".")
# 将点前面的部分转换成整数
p = int(pre<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [【办公类05-04】Python批量修改图片文件名(建立数字文件名,改成EXCEL里面的新文件名)《大班下操作材料包...](https://blog.csdn.net/reasonsummer/article/details/129551462)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *3* [python批量修改文件名字为数字编号](https://blog.csdn.net/m0_52023710/article/details/123760055)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文