python 复制文件并重命名,copy多份规律文件

【C:\Users\Jason Chen\Desktop\demo\test.xlsx】为被复制路径下的文件,
【C:\Users\Jason Chen\Desktop\demo\test{i}.xlsx】为生成后路径下的文件。

import shutil

for i in range(1, 11):
    shutil.copy(r"C:\Users\Jason Chen\Desktop\demo\test.xlsx",
                fr"C:\Users\Jason Chen\Desktop\demo\test{i}.xlsx")
posted @ 2021-12-21 16:20  jasonchenYT  阅读(302)  评论(0编辑  收藏  举报