import os
import time
import sys
import importlib
# 该方法适用于对文件进行指定名字命名
path = "D:\测试重命名"
file_list = os.listdir(path)
n=0
new_name_list = open("C:\Users\xiaoxiaohao\Desktop\名字.txt",'r')
for i in new_name_list:
oldname = path + os.sep +file_list[n]
num_i = i.replace("
","")
newname = path + os.sep + str(num_i)
os.rename(oldname,newname)
print('第'+str(n)+"个,重命名成功")
time.sleep(1)
n = n+1c