Assuming join
wasn't designed that way (which it is, as ATOzTOA pointed out), and it only took two parameters, you could still use the built-in reduce
:
>>> reduce(os.path.join,["c:/","home","foo","bar","some.txt"])
'c:/home\\foo\\bar\\some.txt'
Same output like:
>>> os.path.join(*["c:/","home","foo","bar","some.txt"])
'c:/home\\foo\\bar\\some.txt'
Just for completeness and educational reasons (and for other situations where *
doesn't work).
Hint for Python 3
reduce
was moved to the functools
module.