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])
Please advice me what's wrong with the code above, or any alternative way to get the result I want - to fetch Technician name from SM
Here, e1 is the technician name.
So, your code can go like this :
for e1 in SM:
if SM[e1]['status']=='WIP':
print(SM[e1])
print(e1)