Skip to content

Instantly share code, notes, and snippets.

@kadel
Created October 1, 2013 20:33
Show Gist options
  • Save kadel/6784647 to your computer and use it in GitHub Desktop.
Save kadel/6784647 to your computer and use it in GitHub Desktop.
test = {1:1, 2:{2.1:2.1}, 3:{3.1:{3.2:3.2}}}
def r(a, path=[]):
for k,v in a.iteritems():
if type(v) == dict:
path.append(k)
r(v, path)
path.pop()
else:
print path, k, v
r(test)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment