当前位置:网站首页>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 !")
边栏推荐
- matplotlib. Widgets are easy to use
- 2022.02.13 - NC003. Design LRU cache structure
- Huawei cloud OBS file upload and download tool class
- [research materials] 2021 China online high growth white paper - Download attached
- Golang DNS write casually
- String to leading 0
- VMware virtualization cluster
- Leetcode question brushing (5.28) hash table
- Wireshark grabs packets to understand its word TCP segment
- 化不掉的钟薛高,逃不出网红产品的生命周期
猜你喜欢

Personalized online cloud database hybrid optimization system | SIGMOD 2022 selected papers interpretation

C语言 - 位段

C语言自定义类型:结构体

C language - bit segment

ESP series pin description diagram summary

让学指针变得更简单(三)

Résumé des diagrammes de description des broches de la série ESP

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

指针和数组笔试题解析

hcip--mpls
随机推荐
Migrate data from CSV files to tidb
C语言自定义类型:结构体
What is the use of entering the critical point? How to realize STM32 single chip microcomputer?
3. File operation 3-with
Online yaml to CSV tool
leetcode刷题 (5.31) 字符串
1. Color inversion, logarithmic transformation, gamma transformation source code - miniopencv from zero
升级 TiDB Operator
2022.02.13 - 238. Maximum number of "balloons"
Asia Pacific Financial Media | art cube of "designer universe": Guangzhou community designers achieve "great improvement" in urban quality | observation of stable strategy industry fund
NFT smart contract release, blind box, public offering technology practice -- jigsaw puzzle
[research materials] 2021 live broadcast annual data report of e-commerce - Download attached
Easy to use tcp-udp_ Debug tool download and use
PHP - Common magic method (nanny level teaching)
Nft智能合约发行,盲盒,公开发售技术实战--合约篇
Configuring OSPF load sharing for Huawei devices
从 SQL 文件迁移数据到 TiDB
Tidb backup and recovery introduction
Leetcode question brushing record | 203_ Remove linked list elements
IOT -- interpreting the four tier architecture of the Internet of things