Skip to content

Instantly share code, notes, and snippets.

@philippbayer
Created April 17, 2012 02:19
Show Gist options
  • Save philippbayer/2402979 to your computer and use it in GitHub Desktop.
Save philippbayer/2402979 to your computer and use it in GitHub Desktop.
Dictionary with in
return_dict = {}
for line in file_handle:
line_list = line.split()
if line_list[0] in return_dict.keys():
return_dict[line_list[0]].append(line_list)
else:
return_dict[line_list[0]] = [line_list]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment