There is a dictionary:

l = { "settings": [ [ "Офис","applications-office",18, #0 ["CAT 1.1: Program Name Title","program-name",1], ["CAT 1.2: Program Name For Root","program-name-root",0], ["CAT 1.3: Program Name For Root","program-name-root",0], ], [ "Настройки","applications-office",18, #0 ["CAT 2.1: Program Name Title","program-name",1], ["CAT 2.2: Program Name For Root","program-name-root",0], ["CAT 2.3: Program Name For Root","program-name-root",0], ], ], } 

You need to get all the headers from the internal lists:

  • CAT 1.1: Program Name,
  • CAT 1.2: Program name,
  • ...,
  • CAT 2.3: Program name *
  • one
    What tried to do that did not work? - awesoon
  • From l, take the value by the key settings, get a list, run this list in a loop and get the one you need from the value by indexes. To check, write the values ​​in print - gil9red
  • @soon I did this: for i in range (len ([i [0] for i in root])): print (i, root [i] [3:]) But I can't get the headers (Program name). - CockLobster
  • one
    @CockLobster add better information about the attempts (what you did, with what thought, what brought instead of the expected) in the question itself - yeputons

2 answers 2

 for k in l.keys(): # Перебор всех ключей словаря for i in range(len(l[k])): # Перебор всех подмассивов по ключу for j in range(3, len(l[k][i])): # Перебор элементов подмассива, содержащих нужный текст print(l[k][i][j][0]) # Вывод результата 
  • one
    Please try to write more detailed answers. I am sure the author of the question would be grateful for your expert commentary on the code above. - Nicolas Chabanovsky

Try this:

  ls = [] for i in range(0,2): for j in range(0,6): if type(l['settings'][i][j]) == type(ls): print(l['settings'][i][j][0], ' ', l['settings'][i][j][1]) 
  • Please try to write more detailed answers. I am sure the author of the question would be grateful for your expert commentary on the code above. - Nicolas Chabanovsky