0

I have a function that gives me the following output:<br> Output of print(get_data[0]):

{ 
'data': ({'top_data': {'center': (-71, 90), 'coord': 1},
                      {'id': 0, 'pos': (48, 205)},
                      {'top_data': {'center': (   7, 10, 40), 'coord': 1.5},
                      {'id': 1, 'pos': (43, 105)}),
         'centers_ob':{0: (19, 14, -20), 1: (-49, 22, 26)}, 'time': 13}

I would like to access top_data parameters, as well as centers_ob and time parameters. <br> How could I get those values ? Thank you in advance.

Umutambyi Gad
  • 4,082
  • 3
  • 18
  • 39
Kyv
  • 615
  • 6
  • 26

1 Answers1

2

Here is the solution

data = {'data': ({'top_data': {'center': (-7, 1, 90), 'coord': 1}, 'id': 0, 'pos': (48, 205)}, {'top_data': {'center': (7, 10, 40), 'coord': 1.5}, 'id': 1, 'pos': (43, 105)}), 'centers_ob': {0: (19, 14, -20), 1: (-49, 22, 26)}, 'time': 13}
print(data['data'][0]['top_data'])
print(data['data'][1]['top_data'])
print(data['centers_ob'])
print(data['time'])

Though you should check nested dict

7u5h4r
  • 459
  • 3
  • 10