当前位置:网站首页>文件重命名
文件重命名
2022-07-03 03:06:00 【AphilGuo】
os.rename(ori_name, new_name)
import os
ori_path = './new_name'
folder_list = os.listdir(ori_path)
# print(folder_list)
for i in range(len(folder_list)):
folder_name = folder_list[i]
file_path = os.path.join(ori_path + '/'+ folder_name)
file_list = os.listdir(file_path)
for j in range(len(file_list)):
file_name = file_list[j]
new_name = file_name[:-5] + str(folder_name) + '-' + file_name[-5:]
ori_name = file_path + '/' +file_name
new_name = file_path + '/' +new_name
os.rename(ori_name, new_name)
边栏推荐
- Anhui University | small target tracking: large-scale data sets and baselines
- sql server 查询指定表的表结构
- I2C subsystem (I): I2C spec
- open file in 'w' mode: IOError: [Errno 2] No such file or directory
- JMeter performance test JDBC request (query database to obtain database data) use "suggestions collection"
- I2C subsystem (IV): I2C debug
- 敏捷认证(Professional Scrum Master)模拟练习题-2
- [leectode 2022.2.15] lucky numbers in the matrix
- Source code analysis | resource loading resources
- Xiaodi notes
猜你喜欢
![ASP. Net core 6 framework unveiling example demonstration [02]: application development based on routing, MVC and grpc](/img/cb/145937a27ef08050a370d5a255215a.jpg)
ASP. Net core 6 framework unveiling example demonstration [02]: application development based on routing, MVC and grpc

The process of connecting MySQL with docker

Pytest (6) -fixture (Firmware)

一文带你了解 ZigBee

MySql實戰45講【SQL查詢和更新執行流程】

Docker install redis

Check log4j problems using stain analysis

idea 加载不了应用市场解决办法(亲测)

Add some hard dishes to the interview: how to improve throughput and timeliness in delayed task scenarios!

MySql实战45讲【事务隔离】
随机推荐
Creation and destruction of function stack frame
[fluent] future asynchronous programming (introduction | then method | exception capture | async, await keywords | whencomplete method | timeout method)
Segmentation fault occurs during VFORK execution
Getting started | jetpack hilt dependency injection framework
Process the dataset and use labelencoder to convert all IDs to start from 0
MySql实战45讲【索引】
MySql实战45讲【事务隔离】
What happens between entering the URL and displaying the page?
docker安装redis
Deep learning: multi-layer perceptron and XOR problem (pytoch Implementation)
Yiwen takes you to know ZigBee
Sous - système I2C (IV): débogage I2C
Force deduction ----- the minimum path cost in the grid
Check log4j problems using stain analysis
yii2 中andWhere多个or查询 orm条件
Two dimensional format array format index subscript continuity problem leads to return JSON format problem
Practice of traffic recording and playback in vivo
MySql实战45讲【SQL查询和更新执行流程】
JMeter performance test JDBC request (query database to obtain database data) use "suggestions collection"
用docker 连接mysql的过程