当前位置:网站首页>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)
边栏推荐
- 当lambda没有输入时,是何含义?
- Last update time of all sqlserver tables
- Check log4j problems using stain analysis
- Docker install MySQL
- From C to capable -- use the pointer as a function parameter to find out whether the string is a palindrome character
- 3D drawing example
- 从C到Capable-----利用指针作为函数参数求字符串是否为回文字符
- 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?
- Process the dataset and use labelencoder to convert all IDs to start from 0
- Source code analysis | resource loading resources
猜你喜欢

Sqlserver row to column pivot

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

Kubernetes cluster log and efk architecture log scheme

敏捷认证(Professional Scrum Master)模拟练习题-2

Deep reinforcement learning for intelligent transportation systems: a survey paper reading notes

Idea format code idea set shortcut key format code

Anhui University | small target tracking: large-scale data sets and baselines

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)
![[principles of multithreading and high concurrency: 1_cpu multi-level cache model]](/img/c7/6b5ab4ff7379bfccff7cdbb358ff8f.jpg)
[principles of multithreading and high concurrency: 1_cpu multi-level cache model]
随机推荐
As a leader, how to control the code version and demand development when the epidemic comes| Community essay solicitation
MySQL Real combat 45 [SQL query and Update Execution Process]
当lambda没有输入时,是何含义?
vfork执行时出现Segmentation fault
MySql实战45讲【索引】
Segmentation fault occurs during VFORK execution
复选框的使用:全选,全不选,选一部分
The base value is too large (the error is marked as "08") [duplicate] - value too great for base (error token is'08') [duplicate]
VS code配置虚拟环境
Three. JS local environment setup
二维数组中的元素求其存储地址
PAT乙级“1104 天长地久”DFS优化思路
Are there any recommended term life insurance products? I want to buy a term life insurance.
Joking about Domain Driven Design (III) -- Dilemma
Unity3d human skin real time rendering real simulated human skin real time rendering "suggestions collection"
Variable declarations following if statements
Process the dataset and use labelencoder to convert all IDs to start from 0
Use of El tree search method
[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
左连接,内连接