On Thu, 01 Nov 2007 09:21:40 -0700, nico wrote: > The following example returns a string type, but I need a tuple... >>>> var = ("Hello") >>>> print type(var) > <type 'str'> > > I need that for a method parameter. > Thx
It is the comma, not the brackets, that create tuples. The brackets are recommended for clarity, but aren't always required (except for grouping). >>> 1, 2, 3 (1, 2, 3) The only exception is the special case of an empty tuple, which you create with an empty pair of brackets: >>> () So for a one-element tuple: >>> "Parrot", ('Parrot',) -- Steven. -- http://mail.python.org/mailman/listinfo/python-list