Skip to content

Instantly share code, notes, and snippets.

@indeyets
Created March 8, 2011 08:05
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 indeyets/860017 to your computer and use it in GitHub Desktop.
Save indeyets/860017 to your computer and use it in GitHub Desktop.
tmp = [{'a': 'b'}, {'c': 'd'}]
for x in tmp:
for k in x.keys():
print("key: %s, value: %s" % (k, x[k]))
@the9000
Copy link

the9000 commented Mar 8, 2011

tmp = [{'a': 'b'}, {'c': 'd'}]

for x in tmp:
   for k,v in x.items():
       print("key: %s, value: %s" % (k, v))

or even

for x in tmp:
   for k_v in x.items():
       print("key: %s, value: %s" % k_v)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment