Here is some code to copy a file with shutil.
# copy a file import shutil # copy the file file.txt in the backup folder shutil.copy("file.txt", "backup")
or this way …
with open("file.txt", "rb") as read: with open("backup/file2.txt", "wb") as filetobecopied: filetobecopied.write(read.read())
This is the video about these methods of copying files.