Created
April 17, 2012 23:53
-
-
Save philippbayer/2409977 to your computer and use it in GitHub Desktop.
Python dictionary with 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 | |
d = defaultdict(list) | |
for line in file_handle: | |
line_list = line.split | |
d[line_list[0]].append(line_list) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment