Ahh. Great tip Eric. Thank-you.
Mark
Eric Walstad wrote the following on 2/15/2007 2:58 PM:
> Hey Mark,
> Mark Bystry wrote:
>> sh.copy('C:\testing_it.txt', 'D:\')
>
> Also have a look at the os.path module. Because you want these scripts
> to work on both Linux and Windows, using os.path will let you avoid
> writing platform specific code to handle your slashes.
>
> For example:
> import os
> path_parts_list = ['C:', 'testing_it.txt']
>
> Now, os.path.join will join those path parts together with whatever is
> appropriate for the OS you are running on:
>
> os.path.join(path_parts_list)
>
> This should give you:
> 'c:\testing_it.txt' on Windows and
> 'c:/testing_it.txt' on Linux (which doesn't make sense, but demonstrates
> how os.path can handle your os-specific slashes for you).
>
> There are lots of helpful path related built-ins:
> <http://docs.python.org/lib/module-os.path.html>
>
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor