Last active
October 26, 2019 02:31
-
-
Save tfolkman/e213646de032dc6e1bbd1b326c813aad to your computer and use it in GitHub Desktop.
defaultdict
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
from collections import defaultdict | |
my_default_dict = defaultdict(int) | |
for letter in 'the red fox ran as fast as it could': | |
my_default_dict[letter] += 1 | |
print(my_default_dict) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment