Answers for "write a json to text file python"

20

python json save to file

with open('output.json', 'w') as outfile:
    json.dump(data, outfile)
Posted by: Guest on January-18-2021
0

write json file python

# Python program to write JSON
# to a file
  
  
import json
  
# Data to be written
dictionary ={
    "name" : "sathiyajith",
    "rollno" : 56,
    "cgpa" : 8.6,
    "phonenumber" : "9976770500"
}
  
# Serializing json 
json_object = json.dumps(dictionary, indent = 4)
  
# Writing to sample.json
with open("sample.json", "w") as outfile:
    outfile.write(json_object)
Posted by: Guest on March-01-2022

Code answers related to "Javascript"

Browse Popular Code Answers by Language