Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- import sys
- import json
- def problema4(path):
- try:
- for (root, _, files) in os.walk(path):
- for file in files:
- temp = {}
- k,v = file, open(os.path.join(root, file), "rb").read()
- temp[k] = v.decode('utf-8')
- dictionaryToJson = json.dumps(temp)
- return dictionaryToJson
- except Exception as e:
- print(e)
- p4_path = r"D:\Workspace\Windows\Desktop\asdasdasd\files"
- print(problema4(p4_path))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement