simple string search and replace
bearophileHUGS at lycos.com
bearophileHUGS at lycos.com
Sat Mar 25 16:17:05 EST 2006
Generally, to remove a substring (like ">") from a string you can use
the replace method (that returns a new string):
>>> s = "...anon.wharton.com>..."
>>> s.replace(">", "")
'...anon.wharton.com...'
You can use it with something like:
print [s.replace(">", "") for s in parsed_senders]
or you can put the replace() somewhere in the main loop.
Probably to solve your problem there are other solutions, like using a
RE to find email addresses inside the string...
Bye,
bearophile
More information about the Python-list
mailing list