Copying Files

Fredrik Lundh fredrik at pythonware.com
Sat Jun 7 05:19:36 CEST 2003


Stan Cook wrote:

> Can someone give me a clue on using the copyfile function?  I've tried
> implementing it in this fashion without success.
>
> copyfile(d:\work\temp.dbf, d:\w)

you have to put strings in quotes, and you also have to be
extra careful if the strings contain backslashes:

try this:

    copyfile("d:/work/temp.dbf", "d:/w")

or this:

    copyfile(r"d:\work\temp.dbf", r"d:\w")

a couple of minutes spent on reading the Python tutorial might
be a good investment.  see e.g.

    http://www.python.org/doc/current/tut/node5.html#SECTION005120000000000000000

or read one or more of the documents listed here:

    http://www.python.org/doc/Newbies.html

</F>








More information about the Python-list mailing list