Nested os.path.join()'s

Scott David Daniels Scott.Daniels at Acm.Org
Mon May 5 20:44:44 EDT 2008


Paul Scott wrote:
> ... example:
> if os.path.exists(os.path.join(basedir,picdir)) == True :
>     blah blah
> 
> Question is, is there a better way of doing this? The above *works* but
> it looks kinda hackish...

You've had the joining addressed elsewhere, but note that:
     if os.path.exists(os.path.join(basedir, picdir)):
         blah blah
is a lot better than comparing to True.

--Scott David Daniels
Scott.Daniels at Acm.Org



More information about the Python-list mailing list