for some reason this code does not work, I don’t understand .. should work
import json numbers = [1 ,2 ,3 ,4 ,5 ,6 ,7] file_name = 'numbers.json' with open(file_name, 'w') as f_obj: json.dump(numbers, f_obj) The idea is to create a file - numbers.json, but it is not created. why I do not understand ...
then there should be such a code reading import json data
file_name = 'numbers.json' with open(file_name) as f_obj: numbers = json.load(f_obg) print(numbers) but there is nothing because there is no file - can you give a hint?
file_name = r'c:/temp/numbers.json'And correct:json.load(f_obg)->json.load(f_obj)- MaxUFileNotFoundError(file not found), notNameError: name 'f_obg' is not defined(just a typo). The file is created in the current working directory (may differ from the folder with your script) The current directory in Python is jfs