I'd like to rename the video file and caption file as a list on Python. What should I do at the end?
import os, glob
fpath = glob.glob('e:/utorrent/Neon Genesis Evangelion/*.smi')
movies = glob.glob('e:/utorrent/Neon Genesis Evangelion/*.mkv')
dirl = 'e:/utorrent/Neon Genesis Evangelion/'
nt = os.listdir('e:/utorrent/Neon Genesis Evangelion/')
data_list = []
r_name_list = []
for i in nt:
if i.find('.smi') != -1:
data_list.append(i)
for j in movies:
if j.find('.mkv') != -1:
tn = j.replace('mkv','smi')
r_name_list.append(tn)
for k in data_list:
pp = dirl + k
os.rename(pp, r_name_list) <===== How can I print out the results here?
I'm still not good at repeating myself -ㅜ
python
import os
dirl = 'e:/utorrent/Neon Genesis Evangelion/' nt = os.listdir(dirl) data_list = [] r_name_list = []
for i in nt: if i.find('.smi') != -1: pp = dirl + i data_list.append(pp) elif i.find('.mkv') != -1: tn = i.replace('mkv','smi') pp = dirl + tn r_name_list.append(pp) for j in data_list: os.rename(j, r_name_list.pop()) # Destination filename (refer to destination), name to replace
I solved it. I was able to complete it comfortably using pop using the target list.^
^
571 GDB gets version error when attempting to debug with the Presense SDK (IDE)
564 Uncaught (inpromise) Error on Electron: An object could not be cloned
555 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
803 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
© 2024 OneMinuteCode. All rights reserved.