Jan-19-2020, 10:00 AM
As I said before: there are a lot of ways to store data. Some are more legible than others. I always prefer the most legible solution.
What do you think about the following solution? (It is the same principle as I offered before.)
What do you think about the following solution? (It is the same principle as I offered before.)
>>> filedata = {} >>> filedata['file1'] = {} >>> filedata['file1']['numShifts'] = 8 >>> filedata['file1']['numWorkers'] = 5 >>> filedata['file1']['worker1'] = {} >>> filedata['file1']['worker1']['hours'] = 8 >>> filedata['file1']['worker1']['location'] = [47.123, 15.123] >>> filedata['file1']['numTrucks'] = 3 >>> filedata['file1']['truck1'] = {} >>> filedata['file1']['truck1']['gasoline'] = 150 >>> filedata['file1']['truck1']['location'] = [47.123, 15.123] >>> filedata['file1']['truck1']['miles'] = 15 >>> filedata['file1']['managerid'] = 'Mickey Mouse' >>> >>> filedata {'file1': {'numShifts': 8, 'numWorkers': 5, 'worker1': {'hours': 8, 'location': [47.123, 15.123]}, 'numTrucks': 3, 'truck1': {'gasoline': 150, 'location': [47.123, 15.123], 'miles': 15}, 'managerid': 'Mickey Mouse'}}