468,471 Members | 1,783 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,471 developers. It's quick & easy.

Re: Nested os.path.join()'s

On Mon, 05 May 2008 16:28:33 +0200, Paul Scott <ps****@uwc.ac.zawrote:
>
On Mon, 2008-05-05 at 16:21 +0200, Paul Scott wrote:
>example:

if os.path.exists(os.path.join(basedir,picdir)) == True :
blah blah

Sorry, pasted the wrong example...

Better example:

pics = glob.glob(os.path.join(os.path.join(basedir,picdir ),'*'))

>Question is, is there a better way of doing this? The above *works* but
it looks kinda hackish...
How about not nesting the calls?
>>from os.path import join
join(join('x', 'y'), 'z') == join('x', 'y', 'z')
True
>>>
Jean-Paul
Jun 27 '08 #1
0 1167

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Tcs | last post: by
1 post views Thread by tsuraan | last post: by
2 posts views Thread by Gigs_ | last post: by
2 posts views Thread by Paul Scott | last post: by
reply views Thread by Paul Scott | last post: by
reply views Thread by NPC403 | last post: by
1 post views Thread by kmladenovski | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.