How do I parse a string to a tuple??

shakil ahmad rajshakil at gmail.com
Mon Apr 30 06:34:23 EDT 2007


>
> just do like this:


>>>a="text1 \n text2 \n text3 \n text4"
>>>g=a.split('\n')
>>>g
['text1 ', ' text2 ', ' text3 ', ' text4']
>>> d=tuple(g)
>>> d
('text1 ', ' text2 ', ' text3 ', ' text4')


by

Shakil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070430/17fe67f8/attachment.html>


More information about the Python-list mailing list