import os
path = 'd:/demo_FFD'
with open(os.path.join(path, 'exportelement.txt')) as f:
text = f.readlines()
for line in text[1:]:
try:
port_name, file_name = line.strip().split()
port_name = port_name.split(':')[0]
os.rename('{}/{}.ffd'.format(path, file_name),
'{}/{}.ffd'.format(path, port_name))
except:
pass
沒有留言:
張貼留言