You can use Python shutil module to copy files in Python as shown in the below example –
Function | Copies metadata | Copies permissions | Uses file object | Destination may be directory |
---|---|---|---|---|
shutil.copy | No | Yes | No | Yes |
shutil.copyfile | No | No | No | No |
shutil.copy2 | Yes | Yes | No | Yes |
shutil.copyfileobj | No | No | Yes | No |
1 2 3 4 5 6 7 |
from shutil import copyfile,copy copyfile( ## or copy( |