Skip to content

Instantly share code, notes, and snippets.

@denysbutenko
Last active August 29, 2015 14:06
Show Gist options
  • Save denysbutenko/1bae8cb8a40c04b91c7d to your computer and use it in GitHub Desktop.
Save denysbutenko/1bae8cb8a40c04b91c7d to your computer and use it in GitHub Desktop.
def test_func(test):
return dict(zip(test[0::3], map(list, zip(test[1::3], test[2::3]))))
if __name__ == '__main__':
test_list = range(1, 10)
print "===="
print "Original list: {0}".format(test_list)
print "Transformed into dict: {0}".format(test_func(test_list))
print "===="
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment