当前位置:网站首页>Modify the video name from the name mapping relationship in the table
Modify the video name from the name mapping relationship in the table
2022-07-06 08:24:00 【Don't seek great wealth, just seek wealth to rival the country】
subject :
There is one voiceFile In the folder 50 The suffix is *.pcm The file name needs to be modified , The file suffix is reserved , Modified name reference :rename.csv The innuendo in , The first column is the original name of the document , The second column is the current name of the file , Every line has an innuendo ( First row of old names , The second column is the corresponding new name ), It is required to change the file name of the folder to B Column name
resolvent :
import os
import pandas as pd
from log_utils import Log_util
# csv File path
csv_path=r"C:\Users\xdjiang6\Desktop\rename.csv"
# Video folder path
video_path=r"D:\xdjiang\voiceFile"
# Read csv file
res=pd.read_csv(csv_path)
# The first column is the original name of the document ( Old name )
old_list=res.values[:,0]
# The second column is the current name of the file ( Corresponding new name )
new_list=res.values[:,1]
# Combine the read new name with the old name into a dictionary
name_list=dict(zip(old_list,new_list))
# Read all video files in the video folder
aaa=os.listdir(video_path)
# Determine whether the video file name ==csv Extracted old file name , If equal , Change the video file name to the new file name
for i in aaa:
if i in name_list.keys():
os.rename(os.path.join(video_path,i),os.path.join(video_path,name_list[i]))
Log_util.mlog.debug(f"{
i}: The video name has been modified !")
else:
Log_util.mlog.error(f"{
i}: Not in the table , Please check !")
边栏推荐
- Summary of phased use of sonic one-stop open source distributed cluster cloud real machine test platform
- Circular reference of ES6 module
- [cloud native] teach you how to build ferry open source work order system
- 2022 Inner Mongolia latest water conservancy and hydropower construction safety officer simulation examination questions and answers
- Leetcode question brushing record | 203_ Remove linked list elements
- Remote storage access authorization
- Colorlog结合logging打印有颜色的日志
- C语言自定义类型:结构体
- MFC sends left click, double click, and right click messages to list controls
- The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
猜你喜欢
2022.02.13 - NC004. Print number of loops
【MySQL】数据库的存储过程与存储函数通关教程(完整版)
2022.02.13 - 238. Maximum number of "balloons"
Easy to use tcp-udp_ Debug tool download and use
The State Economic Information Center "APEC industry +" Western Silicon Valley will invest 2trillion yuan in Chengdu Chongqing economic circle, which will surpass the observation of Shanghai | stable
Leetcode question brushing record | 203_ Remove linked list elements
Golang DNS write casually
2022 Inner Mongolia latest construction tower crane (construction special operation) simulation examination question bank and answers
Summary of phased use of sonic one-stop open source distributed cluster cloud real machine test platform
让学指针变得更简单(三)
随机推荐
Artcube information of "designer universe": Guangzhou implements the community designer system to achieve "great improvement" of urban quality | national economic and Information Center
Leetcode question brushing (5.31) string
C语言 - 位段
Restore backup data on S3 compatible storage with br
The State Economic Information Center "APEC industry +" Western Silicon Valley will invest 2trillion yuan in Chengdu Chongqing economic circle, which will surpass the observation of Shanghai | stable
VMware virtualization cluster
From monomer structure to microservice architecture, introduction to microservices
Vocabulary notes for postgraduate entrance examination (3)
Understanding of law of large numbers and central limit theorem
Upgrade tidb with tiup
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
IP lab, the first weekly recheck
MFC 给列表控件发送左键单击、双击、以及右键单击消息
"Designer universe": "benefit dimension" APEC public welfare + 2022 the latest slogan and the new platform will be launched soon | Asia Pacific Financial Media
Hcip day 16
Pointer advanced --- pointer array, array pointer
Yyds dry goods inventory three JS source code interpretation eventdispatcher
远程存储访问授权
NFT smart contract release, blind box, public offering technology practice -- contract
面向个性化需求的在线云数据库混合调优系统 | SIGMOD 2022入选论文解读