Advertisement
Guest User

Untitled

a guest
Apr 19th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. import os
  2. import sys
  3. import json
  4.  
  5. def problema4(path):
  6. try:
  7. for (root, _, files) in os.walk(path):
  8. for file in files:
  9. temp = {}
  10. k,v = file, open(os.path.join(root, file), "rb").read()
  11. temp[k] = v.decode('utf-8')
  12. dictionaryToJson = json.dumps(temp)
  13. return dictionaryToJson
  14. except Exception as e:
  15. print(e)
  16.  
  17. p4_path = r"D:\Workspace\Windows\Desktop\asdasdasd\files"
  18.  
  19. print(problema4(p4_path))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement