当前位置:网站首页>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)
边栏推荐
- Idea set method call ignore case
- Privatization lightweight continuous integration deployment scheme -- 01 environment configuration (Part 2)
- Do you really understand relays?
- 用docker 连接mysql的过程
- MySql实战45讲【索引】
- Spark on yarn resource optimization ideas notes
- MySQL Real combat 45 [SQL query and Update Execution Process]
- I2C subsystem (I): I2C spec
- 基于QT的tensorRT加速的yolov5
- Idea format code idea set shortcut key format code
猜你喜欢
Deep reinforcement learning for intelligent transportation systems: a survey paper reading notes
Gavin teacher's perception of transformer live class - rasa project's actual banking financial BOT Intelligent Business Dialogue robot architecture, process and phenomenon decryption through rasa inte
I2C 子系統(四):I2C debug
MySQL practice 45 [SQL query and update execution process]
函数栈帧的创建与销毁
敏捷认证(Professional Scrum Master)模拟练习题-2
45 lectures on MySQL [index]
Kubernetes family container housekeeper pod online Q & A?
Vs Code configure virtual environment
I2C subsystem (I): I2C spec
随机推荐
idea 加载不了应用市场解决办法(亲测)
What does it mean when lambda is not entered?
ASP. Net core 6 framework unveiling example demonstration [02]: application development based on routing, MVC and grpc
PHP constructor with parameters - PHP constructor with a parameter
Parameter index out of range (1 > number of parameters, which is 0)
ComponentScan和ComponentScans的区别
函数栈帧的创建与销毁
Docker install MySQL
Sous - système I2C (IV): débogage I2C
Cron表达式介绍
Vs 2019 configuration du moteur de génération de tensorrt
Three.js本地环境搭建
MySql實戰45講【SQL查詢和更新執行流程】
[C language] MD5 encryption for account password
I2C subsystem (II): I3C spec
用docker 连接mysql的过程
Check log4j problems using stain analysis
从C到Capable-----利用指针作为函数参数求字符串是否为回文字符
Creation and destruction of function stack frame
处理数据集,使用LabelEncoder将所有id转换为从0开始