shutil.copyfile() Method Syntax
shutil.copyfile(source, destination, *, follow_symlinks = True)
Parameters:
- source: A string representing the path of the source file.
- destination: A string representing the path of the destination file.
- follow_symlinks (optional) : The default value of this parameter is True. If False and source represents a symbolic link then a new symbolic link will be created instead of copying the file.
Note: The ‘*’ in the parameter list indicates that all following parameters (Here in our case ‘follow_symlinks’) are keyword-only parameters and they can be provided using their name, not as positional parameters.
Returns:
This method returns a string that represents the path of the newly created file.
Python | shutil.copyfile() method
Shutil module in Python helps automate the process of copying and removing files and directories. It comes under Python’s standard utility modules.
Shutil(short for shell utility) module also provides many functions of high-level operations on files and collections of files.