Skip to content

Instantly share code, notes, and snippets.

@Mause
Last active August 29, 2015 14:01
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 Mause/1abe1941c20818b37423 to your computer and use it in GitHub Desktop.
Save Mause/1abe1941c20818b37423 to your computer and use it in GitHub Desktop.
>>> l = ['key1', 'value1', 'key2', 'value2']
>>> l = map(str.strip, l)
>>> l = iter(l) # if not already an iterator
>>> d = dict(zip(l, l))
>>> d
{
'key1': 'value1',
'key2': 'value2'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment