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

2008-05-05 Thread Scott David Daniels
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

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

2008-05-05 Thread Grant Edwards
On 2008-05-05, Paul Scott <[EMAIL PROTECTED]> wrote: > Today, I needed to concatenate a bunch of directory paths and files > together based on user input to create file paths. I achieved this > through nested os.path.join()'s which I am unsure if this is a good > thing or n

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

2008-05-05 Thread Paul Scott
On Mon, 2008-05-05 at 10:34 -0400, Jean-Paul Calderone wrote: > How about not nesting the calls? > > >>> from os.path import join > >>> join(join('x', 'y'), 'z') == join('x', 'y', 'z') > True > >>> > Great! Thanks. Didn't realise that you could do that... :) --Paul All Email o

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

2008-05-05 Thread Jean-Paul Calderone
On Mon, 05 May 2008 16:28:33 +0200, Paul Scott <[EMAIL PROTECTED]> wrote: 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

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

2008-05-05 Thread Paul Scott
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 bet

Nested os.path.join()'s

2008-05-05 Thread Paul Scott
Today, I needed to concatenate a bunch of directory paths and files together based on user input to create file paths. I achieved this through nested os.path.join()'s which I am unsure if this is a good thing or not. example: if os.path.exists(os.path.join(basedir,picdir)) == True :