How to Copy a File in Python?
# Copy a file in Python using  copy() method
import shutil
shutil.copy( '/src/test/source.txt' , '/dest/destination.txt' )
                                
                            How to Copy a File in Python?
# Copy a file in Python using  copy() method
import shutil
shutil.copy( '/src/test/source.txt' , '/dest/destination.txt' )
                                
                            How to Copy a File in Python?
# Copy a file in Python using  copyfile() method
import shutil
shutil.copyfile( 'source.txt' , 'destination.txt' )
                                
                            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' )
                                
                            How to Copy a File in Python?
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Function              preserves     supports          accepts     copies other
                      permissions   directory dest.   file obj    metadata  
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
shutil.copy                                            ☐           ☐
shutil.copy2                                           ☐           
shutil.copyfile          ☐             ☐                 ☐           ☐
shutil.copyfileobj       ☐             ☐                            ☐
                                
                            Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us