Extract email id from text file by showing path

Something like the following will work:

with open('resume.txt', 'r') as f_input:
    print re.findall(r'\b([a-z0-9-_.]+?@[a-z0-9-_.]+)\b', f_input.read(), re.I)

It will display:

['[email protected]']

But the exact logic can be far more complicated. It all depends on how accurate it needs to be.

This will display all email addresses in the text file, just in case there is more than one.

Leave a Comment