critique this little script, if you like

Roel Schroeven rschroev_nospam_ml at fastmail.fm
Mon May 1 07:06:44 EDT 2006


John Salerno schreef:
> John Salerno wrote:
>> Dave Jones wrote:
>>> 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.
>>>
>>> Dave
>> Interesting, thanks! I was reading about the normcase() function, but 
>> your suggestion might be better.
> 
> Excellent, works great! But one more question: do I need to import 
> os.path for this? I tried it with and without it, and it worked both 
> ways, so I'm a little uncertain about whether os.path is really a 
> separate module, or if it is still contained within os and doesn't need 
> to be imported separately (it seems like it doesn't, but it is listed 
> separately in the docs).

I always thought I had to import it separately, but just yesterday I 
discovered import os and import os.path do the same thing. If I do one 
of the two, doesn't matter which one, I can access both os.listdir and 
os.path.join.

-- 
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