critique this little script, if you like
Roel Schroeven
rschroev_nospam_ml at fastmail.fm
Mon May 1 07:03:37 EDT 2006
Dave Jones schreef:
> Hi John!
>
> About the path and the \'s, take a look at the os.path.join function.
> The function is smart enough to add the correct slash when joining
> directories.
But watch out with leading backslashes, as in
subdirs = [r'\cgi-bin', r'\images', r'\styles']
os.path.join will assume they are meant to be absolute paths, and will
discard all previous components:
>>> os.path.join('base', 'subdomain', r'\images')
'\\images'
In fact I think it's best to specify components without leading or
trailing backslashes (unless you really want an absolute path):
>>> os.path.join('base', 'subdomain', 'images')
'base\\subdomain\\images'
--
If I have been able to see further, it was only because I stood
on the shoulders of giants. -- Isaac Newton
Roel Schroeven
More information about the Python-list
mailing list