Python @ DjangoSpin

Python: Copying a file

Buffer this pageShare on FacebookPrint this pageTweet about this on TwitterShare on Google+Share on LinkedInShare on StumbleUpon
Reading Time: 1 minutes

Copying a file in Python: You can use either copy() function or copyfile() function of builtin module shutil to create a copy of a file.

Copying a file in Python

import shutil

shutil.copy('textOne.txt', 'textTwo.txt')      # creates 'textTwo.txt' with contents of 'textOne.txt'

Buffer this pageShare on FacebookPrint this pageTweet about this on TwitterShare on Google+Share on LinkedInShare on StumbleUpon

Leave a Reply