Created
February 4, 2019 07:43
-
-
Save nkmrtkhd/7df51fa48dd94ce4a1ae5e7df53e62f0 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
import glob | |
import json | |
def listArray(key,arr): | |
for a in arr: | |
if type(a) is list: | |
listArray(key,a) | |
elif type(a) is dict: | |
listDic(key,a) | |
else: | |
print(key,a) | |
def listDic(key,dic): | |
for k,v in dic.items(): | |
if type(v) is list: | |
listArray(key+"\t"+k,v) | |
elif type(v) is dict: | |
listDic(key+"\t"+k,v) | |
else: | |
print(key+"\t"+k,v) | |
for fpath in glob.glob("./*.json"): | |
print(fpath) | |
f=open(fpath,'r') | |
dic=json.load(f) | |
for key,val in dic.items(): | |
if type(val) is list: | |
listArray(key,val) | |
elif type(val) is dict: | |
listDic(key,val) | |
else: | |
print(key,val) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment