Copy files from one location to another in Python

import shutil
argetdir_path = 'D:\\Python\\code\\PyQt\\1_study.py'
Targetfile_path = 'D:\\Python\\code\\2_study.py'
shutil.copyfile(argetdir_path, Targetfile_path)

The above code is to copy the file 1_study.py whose path is D: \ Python \ code \ PyQt \ 1_study.py to the path of D: \ Python \ code \ 2_study.py, and the copied file is called 2_study.py

Published 41 original articles · praised 13 · visits 6692

Guess you like

Origin blog.csdn.net/comli_cn/article/details/104313522