Ali Maouti

    The code imports the "json" library, creates a dictionary with some data, and then writes the data to the file as JSON.

    "import" "json"
    # Create a dictionary with some data
    data = {
      "name": "John",
      "age": 30,
      "city": "New York"
    # Open a file in write mode
    with open("data.json", "w") as f:
      # Write the data to the file as JSON
      json.dump(data, f)
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.