fork download
  1. import json
  2.  
  3. # Writing to the file
  4. somedict = {'word': 'definition'}
  5. f = open('somefile.json', 'w')
  6. json.dump(somedict, f)
  7. f.close()
  8.  
  9. # and now let's read it from the file
  10. f = open('somefile.json')
  11. somedict = json.load(f)
  12. print somedict
Runtime error #stdin #stdout 0.04s 6732KB
stdin
Standard input is empty
stdout
Standard output is empty