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.

2
  • 3
    This looks really messy and very hard to follow can you please reformat. Commented Jun 24, 2020 at 22:51
  • get_data[0]['data'][i]['top_data'] Commented Jun 24, 2020 at 22:53

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.