当前位置:网站首页>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 !")
边栏推荐
- Migrate data from a tidb cluster to another tidb cluster
- Use Alibaba icon in uniapp
- Upgrade tidb operator
- CAD ARX 获取当前的视口设置
- TiDB备份与恢复简介
- Leetcode question brushing (5.31) string
- Personalized online cloud database hybrid optimization system | SIGMOD 2022 selected papers interpretation
- LDAP Application Section (4) Jenkins Access
- All the ArrayList knowledge you want to know is here
- vulnhub hackme: 1
猜你喜欢
![[research materials] 2022 China yuancosmos white paper - Download attached](/img/b4/422dff0510bbe67f3578202d6e80b7.jpg)
[research materials] 2022 China yuancosmos white paper - Download attached

在 uniapp 中使用阿里图标

Wincc7.5 download and installation tutorial (win10 system)

Convolution, pooling, activation function, initialization, normalization, regularization, learning rate - Summary of deep learning foundation

面向个性化需求的在线云数据库混合调优系统 | SIGMOD 2022入选论文解读

Personalized online cloud database hybrid optimization system | SIGMOD 2022 selected papers interpretation
![[cloud native] teach you how to build ferry open source work order system](/img/fb/507f763791235bd00bc8201e5d7741.png)
[cloud native] teach you how to build ferry open source work order system

3. File operation 3-with

2022.02.13 - NC002. sort

Synchronized solves problems caused by sharing
随机推荐
Wireshark grabs packets to understand its word TCP segment
Tidb backup and recovery introduction
[cloud native] teach you how to build ferry open source work order system
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
[research materials] 2021 Research Report on China's smart medical industry - Download attached
让学指针变得更简单(三)
Step by step guide to setting NFT as an ens profile Avatar
C language custom type: struct
Summary of phased use of sonic one-stop open source distributed cluster cloud real machine test platform
Nacos Development Manual
National economic information center "APEC industry +": economic data released at the night of the Spring Festival | observation of stable strategy industry fund
matplotlib. Widgets are easy to use
CISP-PTE实操练习讲解
【MySQL】数据库的存储过程与存储函数通关教程(完整版)
Introduction to backup and recovery Cr
[2022 Guangdong saim] Lagrange interpolation (multivariate function extreme value divide and conquer NTT)
2. File operation - write
[Yugong series] February 2022 U3D full stack class 010 prefabricated parts
Online yaml to CSV tool
CAD ARX gets the current viewport settings