Created
October 25, 2014 23:53
-
-
Save mistermocha/b838fa9c4ceaa5488fb7 to your computer and use it in GitHub Desktop.
This file contains 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
domain_counts={} | |
for url in urls: | |
# prime the dict if the domain isn't there | |
if not domain_counts.get(domain): | |
domain_counts = {} | |
# split_your_url does not exist | |
domain, path = split_your_url(url) | |
# again, prime the child dict if the path isn't there | |
if not domain_counts[domain].get(path): | |
domain_counts[domain][path] = 0 | |
domain_counts[domain][path] += 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment