马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
1:sub, add
import os
dirname5 = os.path.join('E:', '\sixmp3toxx')
fs5 = [i for i in os.listdir(dirname5)if i.endswith('.mp3')]
[os.rename(i, f'{int(i[0:4])-4000}{i[4:]}') for i in fs5]
2: read txt, copy line to creat mp3
import os
txtline=[]
with open('11.txt','r') as f:
lines = f.readlines()
for line in lines:
txtline.append(line.strip())
for name in txtline:
file1=open(name,'w')
3: rename name in mp5 and file in mp6
import os
fn55 = []
fn66 = []
##获取文件名
dirname5 = os.path.join('E:', '\sixmp5')
fs5 = [i for i in os.listdir(dirname5)if not i.endswith('.py')]
#获取文件
dirname6 = os.path.join('E:', '\sixmp6')
fs6 = [j for j in os.listdir(dirname6)if not j.endswith('.py')]
abspath = lambda x: os.path.join(dirname6, x)
m = 0
x = 0
for fn5 in fs5:
n5, ext5 = os.path.splitext(fn5)
fn55.append(n5)
m=m+1
for fn6 in fs6:
n6, ext6 = os.path.splitext(fn6)
fn66.append(n6)
#print('检查真实文件 是否是.mp3')
print(fn6[4])
if int(n6) == int(n5[0:4]) and fn6[4] is '.' :
os.rename(abspath(fn6), abspath(n5+ext6))
x = x+1
print(x)
|