当前位置:网站首页>文件重命名
文件重命名
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)
边栏推荐
- Process the dataset and use labelencoder to convert all IDs to start from 0
- docker安装redis
- Do you really understand relays?
- SqlServer行转列PIVOT
- [shutter] monitor the transparency gradient of the scrolling action control component (remove the blank of the top status bar | frame layout component | transparency component | monitor the scrolling
- MySql实战45讲【全局锁和表锁】
- open file in 'w' mode: IOError: [Errno 2] No such file or directory
- Getting started | jetpack hilt dependency injection framework
- C语言初阶-指针详解-庖丁解牛篇
- The base value is too large (the error is marked as "08") [duplicate] - value too great for base (error token is'08') [duplicate]
猜你喜欢

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

用docker 连接mysql的过程

一文带你了解 ZigBee

Today, it's time to copy the bottom!

C language beginner level - pointer explanation - paoding jieniu chapter

Super easy to use logzero

Segmentation fault occurs during VFORK execution

MySql實戰45講【SQL查詢和更新執行流程】
![[shutter] monitor the transparency gradient of the scrolling action control component (remove the blank of the top status bar | frame layout component | transparency component | monitor the scrolling](/img/c3/b9a614001f80345a5c1cb3c68ab27c.jpg)
[shutter] monitor the transparency gradient of the scrolling action control component (remove the blank of the top status bar | frame layout component | transparency component | monitor the scrolling

MySql实战45讲【事务隔离】
随机推荐
一文带你了解 ZigBee
[principles of multithreading and high concurrency: 1_cpu multi-level cache model]
Kubernetes cluster log and efk architecture log scheme
Can netstat still play like this?
SQL server queries the table structure of the specified table
I2C 子系统(三):I2C Driver
The process of connecting MySQL with docker
How do you adjust the scope of activerecord Association in rails 3- How do you scope ActiveRecord associations in Rails 3?
Cron表达式介绍
Le processus de connexion mysql avec docker
Today, it's time to copy the bottom!
用docker 连接mysql的过程
模糊查詢時報錯Parameter index out of range (1 > number of parameters, which is 0)
你真的懂继电器吗?
TCP 三次握手和四次挥手机制,TCP为什么要三次握手和四次挥手,TCP 连接建立失败处理机制
tensorflow转pytorch笔记;tf.gather_nd(x,y)转pytorch
Check log4j problems using stain analysis
What is the way out for children from poor families?
从输入URL到页面展示这中间发生了什么?
MySQL practice 45 [SQL query and update execution process]