Created
March 22, 2014 02:11
-
-
Save kojiromike/9700092 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
from collections import defaultdict | |
def person_to_club(_file): | |
result = defaultdict(list) | |
with open(_file) as memberships: | |
for line in filter(None, (l.strip() for l in memberships)): | |
if ',' in line: | |
key = line | |
else: | |
result[key].append(line) | |
return result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment