Hi All,
Is there a possibility that I can change the value of a item in list of dictionaries comparing against another list value?
Say for example I have
1 list as [‘abc’, ‘null’, ‘xyz’] name my_list
And a list of dictionaries like below.
Then looping around the my_list is it possible I can replace value of encryption_password as null like “encryption_password”: null
But key points is only on the second dictionary of the 3 this replacement must happen, as the null appear in my_list in second place. If null appears in the 1st place in the my_list then it should replace encryption_password to null in the 1st dictionaries and respectively when null is 3rd place and replace should happen in 3rd dictionary.
msg: [
{
“auth_method”: “md5”,
“auth_password”: “bdbhfdhq62637bdbd”,
“encryption_method”: “abc”,
“encryption_password”: “ndjsjs173jdjd”,
“user”: “user1”
},
{
“auth_method”: “md5”,
“auth_password”: “bd345dhq6245677bdbd”,
“encryption_method”: “abc”,
“encryption_password”: “ndjjgskgdkdky3jdjd”,
“user”: “user2”
},
{
“auth_method”: “md5”,
“auth_password”: “357ghhrdgjfdhq62637bdbd”,
“encryption_method”: “abc”,
“encryption_password”: “hflhf35873789jd”,
“user”: “user3”
}
]
Regards
Amit