i get error after simple try to store json
json, python, python-3.x
Solution
>>> import json
>>> peinaw = {"hi":4,"pordi":6}
>>> with open('data.json', 'w') as json_data: # 'w' to open for writing
json.dump(peinaw, json_data)
I used a `with` statement here, where the file is automatically `.close()`d at the end of the `with` block.
Problem
In python 3,3 ``` import json peinaw = {"hi":4,"pordi":6} json_data = open('data.json') json.dump(peinaw, json_data) json_data.close() ``` i get ``` File "C:\Python33\lib\json\__init__.py", line 179, in dump fp.write(chunk) io.UnsupportedOperation: not writable ``` tried same thing in 2,7 and it works.I s there a different way in 3,3?