(Oct-22-2019, 01:38 PM)dataplumber Wrote: Can you please let me know what was wrong in my approach ?No, you were not doing the same thing in a single line
I was also doing the same thing but in single line. Isn't that allowed ?
indent
and sort_keys
are arguments that you can pass to json.dumps()
In your snippet
data
is a bytes
object and by using data()
you were trying to call the object like a function (not possible) and getting the error and passing these arguments to itAgain, note that this is not single JSON string. in the loop you print 9 separate JSON strings.
I guess you may want it to be JSON array of JSON objects
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs