当前位置:网站首页>File rename
File rename
2022-07-03 03:09: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)
边栏推荐
- I2C subsystem (III): I2C driver
- Edit and preview in the back pipe to get the value writing method of the form
- Idea format code idea set shortcut key format code
- labelimg生成的xml文件转换为voc格式
- I2C subsystem (II): I3C spec
- 左连接,内连接
- 【富瀚6630编码存录像,用rtsp服务器及时间戳同步实现vlc观看录像】
- Deep Reinforcement Learning for Intelligent Transportation Systems: A Survey 论文阅读笔记
- Docker install redis
- idea 加载不了应用市场解决办法(亲测)
猜你喜欢
vfork执行时出现Segmentation fault
MySql实战45讲【SQL查询和更新执行流程】
Creation and destruction of function stack frame
Kubernetes family container housekeeper pod online Q & A?
Thunderbolt Chrome extension caused the data returned by the server JS parsing page data exception
el-tree搜索方法使用
Opengauss database development and debugging tool guide
用docker 连接mysql的过程
[error record] the parameter 'can't have a value of' null 'because of its type, but the im
Practice of traffic recording and playback in vivo
随机推荐
VS 2019安装及配置opencv
MySQL practice 45 lecture [transaction isolation]
用docker 連接mysql的過程
Joking about Domain Driven Design (III) -- Dilemma
函数栈帧的创建与销毁
Can netstat still play like this?
Last update time of all sqlserver tables
From C to capable -- use the pointer as a function parameter to find out whether the string is a palindrome character
Privatization lightweight continuous integration deployment scheme -- 01 environment configuration (Part 2)
Source code analysis | layout file loading process
Deep Reinforcement Learning for Intelligent Transportation Systems: A Survey 论文阅读笔记
How to select the minimum and maximum values of columns in the data table- How to select min and max values of a column in a datatable?
Kubernetes cluster log and efk architecture log scheme
Three. JS local environment setup
[C language] MD5 encryption for account password
C language beginner level - pointer explanation - paoding jieniu chapter
敏捷认证(Professional Scrum Master)模拟练习题-2
Do you really understand relays?
Find the storage address of the elements in the two-dimensional array
模糊查询时报错Parameter index out of range (1 > number of parameters, which is 0)