On 9 Nov 2006 07:45:25 -0800, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:

>
> I have a string containing: "+abc_cde.fgh_jkl\n" and what I need to
> become is "abc_cde.fgh_jkl".  Could anybody be so kind and write me a
> code of how to extract this text from that string?
>

for that particular string

>>> "+abc_cde.fgh_jkl\n"[1:-1]
'abc_cde.fgh_jkl'
>>> "+abc_cde.fgh_jkl\n".strip()[1:]
'abc_cde.fgh_jkl'
>>> "+abc_cde.fgh_jkl\n"[1:].strip()
'abc_cde.fgh_jkl'
>>> "+abc_cde.fgh_jkl\n"[1:].strip().replace('+','')
'abc_cde.fgh_jkl'
>>> "+abc_cde.fgh_jkl\n"[1:].replace('\n','').replace('+','')
'abc_cde.fgh_jkl'

I'm sure there are other ways too !!

HTH :)
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to