Created
February 5, 2015 22:50
-
-
Save colbypalmer/9135a6059a4c5f474062 to your computer and use it in GitHub Desktop.
Traverse an array by pairs
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
# Used this to turn a 2-column spreadsheet to json key-value pairs | |
def traversebypairs(iterable): | |
a = iter(iterable) | |
return izip(a,a) | |
for a, b in traversebypairs(list): | |
print u'{{"{}", "{}"}},'.format(a, b) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment