Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import json, os
- d = {}
- filenames = sorted([fn for fn in os.listdir() if fn.endswith('.json')])
- for filename in filenames:
- f = open(filename)
- nd = json.load(f)
- # option a:
- d[filename] = nd
- # option b:
- # d.update(nd)
- f = open('result.json', 'w')
- json.dump(d, f)
- f.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement