Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import json, glob, os, sys
- path = os.path.realpath(__file__)
- path = os.path.split(path)[0]
- #print(path,__file__)
- json_files = glob.glob(os.path.join(path,"*.json"))
- #print(json_files)
- json_objs = []
- for filename in json_files:
- with open(filename,"r") as fd:
- json_objs.append(json.load(fd))
- #print(json_objs)
- output = {}
- for obj in json_objs:
- for section in obj.keys():
- if section not in output.keys():
- output[section] = []
- for item in obj[section]:
- if item not in output[section]:
- output[section].append(item)
- json.dump(output,sys.stdout,indent=2)
- sys.stdout.write("\n")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement