Guest User

Untitled

a guest
May 22nd, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. import json
  2. import types
  3.  
  4. path= "R:/IT/temp/json_object.test"
  5.  
  6. test_dict = {'a':'1','b':'2','c_sub':{'sub':'item'}}
  7. dump_file = open(path,'w')
  8.  
  9. obj = json.dumps(test_dict)
  10. dump_file.write(obj)
  11. dump_file.close()
  12.  
  13. load_file = open(path, 'r')
  14. string = json.load(load_file)
  15.  
  16. print types.TypeType(string)
  17. for a,b in string.iteritems():
  18. print a,b
Add Comment
Please, Sign In to add comment