Created
December 18, 2013 22:59
-
-
Save philipsd6/8031369 to your computer and use it in GitHub Desktop.
Convert a flat list of key values into a dictionary
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
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