-
-
Save kf0jvt/8919157 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env python | |
import json | |
vDict=json.loads(open('verisc-enum.json').read()) | |
def dict_walker(inCollection, pre=None): | |
pre = pre[:] if pre else [] | |
#print(pre) | |
if isinstance(inCollection, dict): | |
for key, value in inCollection.iteritems(): | |
if isinstance(value, dict): | |
for d in dict_walker(value, pre+ [key]): | |
yield d | |
elif isinstance(value, list) or isinstance(value, tuple): | |
for v in value: | |
for d in dict_walker(v, pre+ [key] ): | |
yield d | |
else: | |
print(end) | |
yield '.'.join(pre) + '.' + d | |
elif isinstance(inCollection, list) or isinstance(inCollection, tuple): | |
for v in inCollection: | |
for d in dict_walker(v, pre ): | |
yield d | |
else: | |
yield '.'.join(pre) + '.' + inCollection | |
for key in vDict.keys(): | |
for y in dict_walker(vDict[key],[key]): | |
print(y) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment