*tuple vs tuple example print os.path.join(os.path.dirname(os.tmpnam()), *("a", "b", "c"))

Steve steve.morin at gmail.com
Tue Dec 13 17:09:35 EST 2005


I have been trying to find documentation on the behavior
Can anyone tell me why the first example works and the second doesn't
and where I can read about it in the language reference?
Steve

 print os.path.join(os.path.dirname(os.tmpnam()),*("a","b","c"))
#works
OUTPUT:/var/tmp/a/b/c
and

 print os.path.join(os.path.dirname(os.tmpnam()),("a","b","c"))  #
doesn't
OUTPUT:Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File
"/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/posixpath.py",
line 60, in join
    if b.startswith('/'):
AttributeError: 'tuple' object has no attribute 'startswith'




More information about the Python-list mailing list