for loop specifying the amount of vars
lists at js3d.co.uk
Mon Nov 24 20:40:06 CET 2008
Sorry for the noise, I found the * unpack operator. Perfect for what I need.
> I have a list which contains a folder structure, for instance:
> dirs=['c:\', 'temp', 'foo', 'bar']
> The length of the list can vary. I'd like to be able to construct a
> os.path.join on the list, but as the list can vary in length I'm unsure
> to do this neatly. I figured I could use a for loop and build the whole
> statement as a string and 'eval it', but I'm aware that this is not a
> It strikes me that there probably is a very elegant way to achieve what
> want to do, any pointers much appreciated.
More information about the Python-list