Answers for "how to copy a file in python"

6

copy file in python3

import shutil

original = r'original path where the file is currently stored\file name.file extension'
target = r'target path where the file will be copied\file name.file extension'

shutil.copyfile(original, target)
Posted by: Guest on May-21-2020
0

How to Copy a File in Python?

# Copy a file in Python using  copyfile() method
import shutil
shutil.copyfile( 'source.txt' , 'destination.txt' )
Posted by: Guest on September-25-2021
1

How to Copy a File in Python?

# Copy a file in Python using  copy2() method
import shutil
shutil.copy2( '/src/test/source.txt' , '/dest/destination.txt' )
Posted by: Guest on September-25-2021

Code answers related to "how to copy a file in python"

Python Answers by Framework

Browse Popular Code Answers by Language