Skip to content

Instantly share code, notes, and snippets.

@j08lue
Created June 16, 2015 09:46
Show Gist options
  • Save j08lue/49eb1c56a514a7579568 to your computer and use it in GitHub Desktop.
Save j08lue/49eb1c56a514a7579568 to your computer and use it in GitHub Desktop.
Find email addresses in some text (e.g. html) file
import re
with open('cic.html', 'r') as f:
raw = f.read()
r = r"[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?"
add = re.findall(r, raw)
unique = sorted(set(add))
print '; '.join(unique)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment