Вложенный словарь для одного или ни одного [дубликат]Python

Программы на Python
Гость
Вложенный словарь для одного или ни одного [дубликат]

Сообщение Гость »


У меня есть вложенный словарь, как показано ниже:

Код: Выделить всё

{'head1': {'args': 'arg1',
'sch': ('0-59', '05-09', 12, '03', '*')},
'head2': {'args': 'arg2',
'sch': ('0-59', '05-09', 12, '03', '*')}
I want the output as:

Код: Выделить всё

head1:
args: args1
sche: 0-59 05-09 12 03 *
head2:
args: args2
sche: 0-59 05-09 12 03 *
I wanted to reduce or remove the dictionary completely. please suggest an idea on how to approach this problem, open to any ideas...
I tried something below, almost near to what am looking check = []

Код: Выделить всё

for k,v in tot.items():
check.append(k)
for j,l in v.items():
check.append(l)
FYI , I am developing this solution to auto generate the cron schedules according to the user input


Источник: https://stackoverflow.com/questions/781 ... le-or-none

Вернуться в «Python»