当前位置:网站首页>文件重命名
文件重命名
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)
边栏推荐
- Spark on yarn资源优化思路笔记
- A2L file parsing based on CAN bus (2)
- MySql实战45讲【SQL查询和更新执行流程】
- 一文带你了解 ZigBee
- Chart. JS multitooltip tag - chart js multiTooltip labels
- open file in 'w' mode: IOError: [Errno 2] No such file or directory
- Use of check boxes: select all, deselect all, and select some
- Super easy to use logzero
- Use cve-2021-43893 to delete files on the domain controller
- The difference between componentscan and componentscans
猜你喜欢

SQL statement
![[error record] the parameter 'can't have a value of' null 'because of its type, but the im](/img/1c/46d951e2d0193999f35f14d18a2de0.jpg)
[error record] the parameter 'can't have a value of' null 'because of its type, but the im

Force deduction ----- the minimum path cost in the grid

I2C 子系统(四):I2C debug

Do you really understand relays?

Installation and use of memory leak tool VLD

A2L file parsing based on CAN bus (2)
![[principles of multithreading and high concurrency: 1_cpu multi-level cache model]](/img/7e/ad9ea78868126b149bd9f15f587e6c.jpg)
[principles of multithreading and high concurrency: 1_cpu multi-level cache model]

Didi programmers are despised by relatives: an annual salary of 800000 is not as good as two teachers

Sqlserver row to column pivot
随机推荐
Thunderbolt Chrome extension caused the data returned by the server JS parsing page data exception
Privatization lightweight continuous integration deployment scheme -- 01 environment configuration (Part 2)
Add MDF database file to SQL Server database, and the error is reported
Tensorflow to pytorch notes; tf. gather_ Nd (x, y) to pytorch
Practice of traffic recording and playback in vivo
处理数据集,使用LabelEncoder将所有id转换为从0开始
TCP handshake three times and wave four times. Why does TCP need handshake three times and wave four times? TCP connection establishes a failure processing mechanism
MySql实战45讲【事务隔离】
I2C 子系统(四):I2C debug
从C到Capable-----利用指针作为函数参数求字符串是否为回文字符
The process of connecting MySQL with docker
What is the way out for children from poor families?
Can netstat still play like this?
SQL statement
TCP 三次握手和四次挥手机制,TCP为什么要三次握手和四次挥手,TCP 连接建立失败处理机制
C语言中左值和右值的区别
Strategy application of Dameng database
MySql实战45讲【行锁】
What does it mean when lambda is not entered?
Distributed transaction