Created
June 16, 2015 09:46
-
-
Save j08lue/49eb1c56a514a7579568 to your computer and use it in GitHub Desktop.
Find email addresses in some text (e.g. html) file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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