You can use the os module to build path names in a platform-independent
manner.  On my Linux box, I can type

>>> BASE = '/'
>>> import os
>>> os.path.join(BASE, 'foo', 'bar', 'baz')
'/foo/bar/baz'

On a Windows machine, you get

>>> BASE = 'C:'
>>> import os
>>> os.path.join(BASE, 'foo', 'bar', 'baz')
'C:\\foo\\bar\\baz'

This is a little more cumbersome that just typing the string, but using
os.path.join makes it easy to port your scripts to a new platform.
Check out http://docs.python.org/lib/module-os.path.html for more
information.
Cheers,

Michael

--
Michael Hartl
http://michaelhartl.org/

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to