[Tutor] creating .json files
Rafael Knuth
rafael.knuth at gmail.com
Thu Apr 13 12:32:41 EDT 2017
Is there a way to split these two into separate steps:
a) creating a .json file
b) manipulating it (a, r, w ...)
Example:
"import json
number_list = [1, 2, 3, 4, 5, 6, 7, 8, 9]
file_name = "my_numbers.json"
with open(file_name, "w") as a:
json.dump(number_list, a)
What if I just wanted to create a .json file and do nothing with it?
import json
file_name = "my_numbers.json"
The above does not do the job. What am I getting wrong here? Thanks.
More information about the Tutor
mailing list