stripping punctuation from tuples

Louis Luangkesorn lluang at northwestern.edu
Sun Mar 18 22:37:48 EST 2001


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
database)

>>> 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]

'Alan','Tsang'

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

But that is not quite what I want.
Many thanks.
Louis
--
K Louis Luangkesorn
lluang at northwestern.edu  http://pubweb.nwu.edu/~kll560  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