Skip to content

Instantly share code, notes, and snippets.

@nimit2801
Created November 6, 2020 20:39
Show Gist options
  • Select an option

  • Save nimit2801/ff9e12c81e6309df1fdc4b434fbb540c to your computer and use it in GitHub Desktop.

Select an option

Save nimit2801/ff9e12c81e6309df1fdc4b434fbb540c to your computer and use it in GitHub Desktop.

Revisions

  1. nimit2801 created this gist Nov 6, 2020.
    15 changes: 15 additions & 0 deletions json_read_write.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    import json

    with open("person.json", "r") as json_read:
    json_dict = json.load(json_read)

    name = input("enter your name: ")

    json_dict["name"] = name
    print(json_dict["name"])


    person_dict = json_dict

    with open('person.json', 'w') as json_file:
    json.dump(person_dict, json_file)
    1 change: 1 addition & 0 deletions person.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    {"name": "zombie", "languages": ["English", "Fench"], "married": true, "age": 32}