Created
February 24, 2021 18:34
-
-
Save SingAvi/4daa9308515261f976533f4f7c663005 to your computer and use it in GitHub Desktop.
dd.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
data = {} | |
user = [] | |
with open('data.json', 'r') as j: | |
json_data = json.load(j) | |
print(json_data) | |
name = input("Name : ") | |
x = { | |
"name": name, | |
} | |
json_data["emp"].append(x) | |
print(json_data) | |
json_object = json.dumps(json_data, indent=4) | |
with open("data.json", "w") as outfile: | |
outfile.write(json_object) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment