I have a dictionary like-
mydict = {
'users': [
{
'userid': 'u1234',
'name': 'user1'
},
{
'userid': 'u0007',
'name': 'user2'
}
]
}
I want a functionality such that if I pass userid=u1234 it should iterate through the dictionary and delete the details for that userid from the dictionary and then write the output to a file.