I am an dictionary (Dictionary of dictionary)
old_dict = {
'1':{'A':1, 'check': 0, 'AA':2, 'AAA':3 , 'status':0},
'2':{'A':11,'check': 0, 'AA':22, 'AAA':33 ,'status':1},
'3':{'A':111,'check': 0, 'AA':222, 'AAA':333 ,'status':0},
'4':{'A':1111,'check': 1, 'AA':2222, 'AAA':3333 ,'status':0},
}
I Want to get a new dictionary that before['check'] != 0 and before['status'] != 0 so will be
new_dict = {
'1':{'A':1, 'check': 0, 'AA':2, 'AAA':3 , 'status':0},
'3':{'A':111,'check': 0, 'AA':222, 'AAA':333 ,'status':0},
}
If it's a list I did like this
ouputdata = [d for d in data if d[1] == ' 0' and d[6]==' 0']
I have tried
for field in old_dict.values():
if field['check'] !=0 and field['status'] != 0
line = field['A'] + field['AA']+field['AAA']
#write these line to file
How Make it with dictionary. Could you help me to make it with dictionary