stripping punctuation from tuples

Brian Quinlan brian at
Mon Mar 19 07:36:13 CET 2001

Tuples are sequence types, like lists, and you can use the same notation to
reference their elements.

Using your example, you might want to try the following:

>>> a[10][0]
'Alan Tsang'
>>> name, = a[10] # Another alternative
>>> name
'Alan Tsang'

-----Original Message-----
From: python-list-admin at
[mailto:python-list-admin at]On Behalf Of Louis Luangkesorn
Sent: Sunday, March 18, 2001 7:38 PM
To: python-list at
Subject: stripping punctuation from tuples

How do you strip the punctuation from tuples?  In particular, say I have
a tuple a[10] (which happened to come from a not very well designed

>>> a[10]
('Alan Tsang',)

How do I get something to say 'Alan Tsang'  with out the parens or the

Or, what I'm really trying to do is make this so
>>>b = breakname(a[10])
>>>b[0], b[1]


I've tried to do:
>>> d = split(str(a[0]))
>>> d
["('Aaron", "Fan',)"]
>>> d[0]
>>> d[1]

But that is not quite what I want.
Many thanks.
K Louis Luangkesorn
lluang at  PGP:0xF3E2D362

Whatsoever things are true, ... honest, ... just, ... pure, ... lovely,
... of good report; if there be any virtue, and if there be any praise,
think on these things.
     - motto - Northwestern University (Phil 4:8)

More information about the Python-list mailing list