simple string search and replace

bearophileHUGS at bearophileHUGS at
Sat Mar 25 22:17:05 CET 2006

Generally, to remove a substring (like ">") from a string you can use
the replace method (that returns a new string):

>>> s = ">..."
>>> s.replace(">", "")

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...


More information about the Python-list mailing list