Skip to content

Instantly share code, notes, and snippets.

@sholfen
Created November 8, 2015 12:51
Show Gist options
  • Save sholfen/775a824da2121df04b7d to your computer and use it in GitHub Desktop.
Save sholfen/775a824da2121df04b7d to your computer and use it in GitHub Desktop.
To count email domain
email_string = '[email protected];[email protected];[email protected]'
emails = email_string.split(';')
print emails
email_domains = {}
for email in emails:
domain = email.split('@')[1].strip()
if domain in email_domains:
email_domains[domain] += 1
else:
email_domains[domain] = 1
print email_domains
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment