#文件、文件夹的移动、复制、删除、重命名 #导入shutil模块和os模块 import shutil, os for num in range(1,11): #1到10次循环 file_path = "D:\\Program Files (x86)\\QQ记录\\14***" # 复制单个文件 换行符为\ 单引号和双引号是不区分的 file_path1 = file_path + "\\ShenZhouZhong.h1d" file_path2 = file_path + "\\ShenZhouZhong" + str(num) + ".h1d" shutil.copy(file_path1, file_path2) #复制整个目录(备份) file_path3 = file_path + "\\ShenZhouZhong" file_path4 = file_path + "\\ShenZhouZhong" + str(num) shutil.copytree(file_path3, file_path4) print("Yes, I do it")