Python: Saving API result into json file?
This question already has an answer here:
I'm assuming you have the data into a variable inside your code. So:
You first need to transform this data into a json object (if you just add this list into an object, like "{'list':" + this_data + "}" you have a json!).
So then you only need to get this json data and write it into a file:
writeFile =open('file_name.json', 'w')
writeFile.write(your_data)
writeFile.close()
Hope this might help you :)
链接地址: http://www.djcxy.com/p/48690.html