On Thu, Apr 13, 2017 at 12:32 PM, Rafael Knuth <rafael.kn...@gmail.com> 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_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. > > If you want to have a file after the program runs you need to "open" it. And close it. Otherwise you reference a file but leave no trace. _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor