更新时间:2022-12-30 11:25:15
我会尝试:
import os
dst = "C:\\Users\\Aydan\\Desktop\\1855\\" # make sure this is a path name and not a filename
with open('1855.txt') as my_file:
for filename in my_file:
src = os.path.join("C:\\Users\\Aydan\\Desktop\\data01\\BL\\ER\\D11\\fmp000005578\\", filename.strip() ) # .strip() to avoid un-wanted white spaces
os.rename(src, os.path.join(dst, filename.strip()))