[Tutor] STRING PROC

spawgi at gmail.com spawgi at gmail.com
Fri May 20 16:05:05 CEST 2011


You can also try this

>>> a = '<NAME'
>>> a
'<NAME'
>>> a.partition('<')
('', '<', 'NAME')
>>> splitstring = a.partition('<')
>>> splitstring
('', '<', 'NAME')
>>> splitstring[0]
''
>>> splitstring[1]
'<'
>>> splitstring[2]
'NAME'

I guess you can use this tuple.

Hope this helps.

Thanks and Regards,
Sumod

On Fri, May 20, 2011 at 6:42 PM, Spyros Charonis <s.charonis at gmail.com>wrote:

> Hello List,
>
> A quick string processing query. If I have an entry in a list such as
> ['>NAME\n'],
> is there a way to split it into two separate lines:
>
> >
> NAME
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
>


-- 
http://spawgi.wordpress.com
We can do it and do it better.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110520/9863660b/attachment.html>


More information about the Tutor mailing list