> You need to open the file to create it:
Ok, got you. Thanks, Alan!
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
On 13/04/17 17:32, Rafael Knuth wrote:
> Is there a way to split these two into separate steps:
> a) creating a .json file
> b) manipulating it (a, r, w ...)
Of course.
> What if I just wanted to create a .json file and do nothing with it?
>
> import json
> file_name = "my_numbers.json"
>
> The
On Thu, Apr 13, 2017 at 12:32 PM, Rafael Knuth
wrote:
> 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_n
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 cr