simple string search and replace

Kun neurogasm at gmail.com
Sat Mar 25 21:53:47 CET 2006


hey guys, here's my code,

senders = [('460 (BODY[HEADER.FIELDS (FROM)] {46}', 'From: Friend 
<anon at anon.wharton.com>\r\n\r\n'), ')', ('462 (BODY[HEADER.FIELDS 
(FROM)] {37}', 'From: Kun <neurogasm at gmail.com>\r\n\r\n'), ')']
print senders
parsed_senders = []
sender = ""
for item in senders:
    if isinstance(item,tuple):
       item= ''.join(item)
    if item==')':
       parsed_senders.append(sender[sender.find('<')+1:].strip())
       sender = ""
    else:
       sender+=item
print parsed_senders




wondering if anyone knows how i can remove the '>'s from the list, which 
outputs to something like ['anon at anon.wharton.com>', 'neurogasm at gmail.com>']



More information about the Python-list mailing list