In <[email protected]> ksals
<[email protected]> writes:
> Please help a newbe. I have a string returned from an esygui
> multchoicebox that looks like
> this: ('ksals', '', 'alsdkfj', '3', '') I need to convert this to
> this: ['ksals', '', 'alsdkfj', '3', '']
That looks like a tuple which contains five strings. But you said it's
a string, so I'll believe you.
>>> x = "('ksals', '', 'alsdkfj', '3', '')"
>>> print x
('ksals', '', 'alsdkfj', '3', '')
>>> y = "[%s]" % x[1:-1]
>>> print y
['ksals', '', 'alsdkfj', '3', '']
--
John Gordon A is for Amy, who fell down the stairs
[email protected] B is for Basil, assaulted by bears
-- Edward Gorey, "The Gashlycrumb Tinies"
--
http://mail.python.org/mailman/listinfo/python-list