un-tuple (newbie)

Martin Doering doeringm at gmx.de
Tue Dec 2 09:55:22 EST 2003


On Tue, 02 Dec 2003 14:09:54 +0100, Peter Otten <__peter__ at web.de>
wrote:

>Martin Doering wrote:
>
>> I could find out, how to create a tuple with just one member, but I
>> can not find out how to get a value from a tuple with just one member.
>>...
>
>You already got the above solution. Here is another one:
>
>>>> item, = tpl
>>>> item
>'first item'

Cool. And I don't find it too ugly. You just see the  ',' and know,
that it is a sequence. Sound's logical, even if it is just one item.

--
Martin




More information about the Python-list mailing list