Mar-07-2018, 10:33 AM
Hi
I'm struggling with this variable that i think is a dictionary
This is what i have
I'm very confused. Should this be a class? how do i do it?
help here
I'm struggling with this variable that i think is a dictionary
This is what i have
page = [ {'id': 1, 'name': 'initial', 'components': [ {'id': 1, 'type': 'button', 'name': 'bt_settings'}, {'id': 2, 'type': 'button', 'name': 'bt_sensors'}, {'id': 3, 'type': 'button', 'name': 'bt_start'}, ] }, {'id': 2, 'name': 'settings', 'components': [ {'id': 1, 'type': 'text', 'name': 'txt_filename'}, {'id': 2, 'type': 'text', 'name': 'txt_googlecrd'}, ] }, {'id': 3, 'name': 'testType', 'components': [ {'id': 11, 'type': 'button', 'name': ''}, {'id': 12, 'type': 'text', 'name': 'txt_other'}, ] }, ]Now let's suppose that for the component 'txt_filename' in page 'settings' i want to know the respective id fields? In this case page id = 2 and component id = 1
I'm very confused. Should this be a class? how do i do it?
help here