homedir, file copy

Chris Rebert clp2 at rebertia.com
Sun Jan 30 18:23:28 EST 2011


On Sun, Jan 30, 2011 at 3:13 PM, ecu_jon <hayesjdno3 at yahoo.com> wrote:
> On Jan 30, 3:55 pm, r <rt8... at gmail.com> wrote:
>> On Jan 30, 2:44 pm, ecu_jon <hayesjd... at yahoo.com> wrote:
>>
>> > shutil.copy (homedir+"\\backup\\", homedir+"\\backup2\\")
>>
>> TIP: Use os.path.join(x,y, z*)
>>
>> > why is there still two \\ in the pathfor the copy command?
>>
>> I always convert my paths to use a single '/' instead of '\\'. Just
>> makes life that much easier!
>
> what does this mean?  Use os.path.join(x,y, z*)
> what is the x,y,z?

See http://docs.python.org/library/os.path.html#os.path.join
e.g. in your case:
backupdir = os.path.join(homedir, "backup")

Cheers,
Chris



More information about the Python-list mailing list