Copy a file in python

Andrew Markebo andrew.markebo at telia.com
Wed Dec 4 06:31:56 EST 2002


/ Mikael Olofsson <mikael at isy.liu.se> wrote:
| On 4 Dec 2002 00:46:29 -0800
| anandpillai6 at yahoo.com (Anand) wrote:
>> What is the function to copy a file in python?
>
| If I were to be verbose, I would probably do the following
>
| originalFile = open(originalPath,'r')
| targetFile = open(targetPath,'w')
| targetFile.write(originalfile.read())

Or use some copy-function from the shutil package.. 

   /Andy

-- 
 The eye of the beholder rests on the beauty!



More information about the Python-list mailing list