Skip to content

Instantly share code, notes, and snippets.

@belsander
Created December 11, 2016 15:57
Show Gist options
  • Save belsander/6b901b7ef60fad1a93a02d20db45d70d to your computer and use it in GitHub Desktop.
Save belsander/6b901b7ef60fad1a93a02d20db45d70d to your computer and use it in GitHub Desktop.
zip([iterable, ...])
# Example
>>> test_list1 = ["a", "b", "c"]
>>> test_list2 = [1, 2, 3]
>>> zip(test_list1, test_list2)
[('a', 1), ('b', 2), ('c', 3)]
>>> dict(zip(test_list1, test_list2))
{'a': 1, 'c': 3, 'b': 2}
>>> test_list2 = [1, 2, 3, 4]
>>> dict(zip(test_list1, test_list2))
{'a': 1, 'c': 3, 'b': 2}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment