我想将/local/mnt/workspace/user/Automation/swbuild/board/test_new.html
复制为/local/mnt/workspace/user/Automation/sw_admin/reports/board/test.html
,如果它已经存在则覆盖test.html
..是否有内置的python复制命令来执行此操作?
/local/mnt/workspace/user/Automation/swbuild/board/test_new.html
/local/mnt/workspace/user/Automation/sw_admin/reports/board/test.html
答案 0 :(得分:1)
使用shutil.copy
:
import shutil
shutil.copy('/local/mnt/workspace/user/Automation/swbuild/board/test_new.html',
'/local/mnt/workspace/user/Automation/sw_admin/reports/board/test.html')