2021年3月29日星期一

Print details from nested dictionary

SM={'Technician A':{'Ticket ID':1,'Start date':'14-03-2020','End date':'25-03-2020',' location':'Area 1','status':'Delivered'},        'Technician B':{'Ticket ID':2,'Start date':'14-03-2020','End date':'25-03-2020',' location':'Area 3','status':'WIP'},        'Technician C':{'Ticket ID':3,'Start date':'14-03-2020','End date':'25-03-2020',' location':'Area 2','status':'WIP'},        'Technician D':{'Ticket ID':4,'Start date':'14-03-2020','End date':'25-03-2020',' location':'Area 7','status':'Delivered'},       'Technician E':{'Ticket ID':5,'Start date':'14-03-2020','End date':'25-03-2020',' location':'Area 8','status':'Delivered'},       'Technician F':{'Ticket ID':6,'Start date':'14-03-2020','End date':'25-03-2020',' location':'Area 9','status':'Delivered'}}  

From SM dictionary I want to Print all details where the status is WIP with Technician Name which is Technician A, Technician B...…

I have tried below code but not getting technician name:

for e1 in SM:      if SM[e1]['status']=='WIP':           print(SM[e1])  
https://stackoverflow.com/questions/66864581/print-details-from-nested-dictionary March 30, 2021 at 11:55AM

没有评论:

发表评论