I'm working on a python project in which I need to create a new JSON file with a JSON object.
Here's what I have tried:
data = {
'uid': userId,
'description': description,
'inputs': inputs,
'outputs': outputs,
'ex_inputs': example_input,
'ex_outputs': example_output,
'miscs': misc
}
print(data)
# Writing Finalized JSON description files
with open('finalized/description_' + str(fid) + '.json', 'w') as f:
f.write(json.dumps(data))
I need the name of file as description_FID.json where FID is an integer value comes from HTML form.I have created an empty directory as finalized but it doesn't create the file in this directory.
Help me, please!
Thanks in advance!