Skip to content

Instantly share code, notes, and snippets.

@kojiromike
Created March 22, 2014 02:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kojiromike/9700092 to your computer and use it in GitHub Desktop.
Save kojiromike/9700092 to your computer and use it in GitHub Desktop.
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