[Zope] Python Question

Andrew Veitch andrew at logicalprogression.net
Wed May 5 11:44:35 EDT 2004


> first last <flast at domain.com>
> 
> How can I extract all of the text up to but not including the < and assign
> to a new variable?

You should use parseaddr from the excellent email library see:

http://docs.python.org/lib/module-email.Utils.html

The advantage of using the utility rather than slicing the string yourself
is that there's always a case with email that you haven't thought about.

If you're using an older Python you may need to download the email library
from http://www.python.org/sigs/email-sig/

A

-- 
Logical Progression Ltd, 20 Forth Street, Edinburgh EH1 3LH, UK
Tel: +44 (0)131 550 3733 Web: http://www.logicalprogression.net/




More information about the Zope mailing list