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)

上面的代碼是說把路徑爲D:\Python\code\PyQt\1_study.py的文件1_study.py複製到D:\Python\code\2_study.py的路徑下面去,複製過來的文件叫2_study.py

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章