I have a document with a list of orders, how do I get python to compile a list of the order Id's in the file? I have got it to read the file, with file = open('Orders_example.json') print(file.read()) However I need the file to be saved to a list in python, how do I do this? I have checked the file you have question you have asked and it doesn't work, it comes up withTraceback (most recent call last): File "/Users/Jess/Documents/The one.py", line 3, in data = json.loads(data_file.read())
Asked
Active
Viewed 321 times
0
-
Take a look at the json module. – PM 2Ring Jun 16 '16 at 15:23
-
My code looks like this import json from pprint import pprint with open('Orders_example.json') as data_file: data = json.load(data_file) pprint(data)* And I get an error code looking like this *Traceback (most recent call last): File "/Users/Jess/Documents/Start Fresh.py", line 5, in
data = json.load(data_file)* – Ben Herbig Jun 16 '16 at 15:34