Skip to content

Instantly share code, notes, and snippets.

@philipsd6
Created December 18, 2013 22:59
Show Gist options
  • Save philipsd6/8031369 to your computer and use it in GitHub Desktop.
Save philipsd6/8031369 to your computer and use it in GitHub Desktop.
Convert a flat list of key values into a dictionary
data = dict(line.split(None, 1) for line in '''
key1 value
key2 value
key3 another value
key4 yet another value
'''.strip().splitlines())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment