Answer the question
In order to leave comments, you need to log in
Why does the JSON view disappear when writing to a file?
There is such a line (an array from JSON, already converted by json.dumps):
I'm trying to write it to a file
test = [{"a": 1, "b": 2}, {"c": 3, "d": 4}]
with open(path, 'w') as fw:
fw.write(result)
[{'a': 1, 'b': 2}, {'c': 3, 'd': 4}]
Answer the question
In order to leave comments, you need to log in
it depends on the type of application. I won’t tell you everything, but for example, if the application type is "embedded application" - "application" or "game", then they do not have support for the mobile version.
and for example, the community application has a mobile version of the
type "VK Apps" also has a mobile version
You need to use json.dump:
import json
test = [{"a": 1, "b": 2}, {"c": 3, "d": 4}]
with open('test.json', 'w') as file:
json.dump(test, file)
[{"a": 1, "b": 2}, {"c": 3, "d": 4}]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question