Python Write Json to File

July 15, 2019
data = {'name': 'Desmond Lua', age=40}

with open('test.json', 'w') as f:
    # json.dump(data, f, indent=2) # for nice formatting
    json.dump(data, f)
This work is licensed under a
Creative Commons Attribution-NonCommercial 4.0 International License.