Answers for "import json to python file"

11

open json file python

import json

with open('data.txt') as json_file:
    data = json.load(json_file)
Posted by: Guest on March-02-2020
1

python object to json file

data = {
  "your json": "has data!"
}

with open('data.txt', 'w') as outfile:
    json.dump(data, outfile)
Posted by: Guest on October-06-2021

Python Answers by Framework

Browse Popular Code Answers by Language