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/db3c2a3e2bb09a600895 to your computer and use it in GitHub Desktop.
Save Mause/db3c2a3e2bb09a600895 to your computer and use it in GitHub Desktop.
>>> l = [' key1 ', ' value1 ', ' \tkey2', 'value2\t\n']
>>> l = [s.strip() for s in l]
>>> d = dict(zip(l[::2], [1::2]))
>>> d
{
'key1': 'value1',
'key2': 'value2'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment