I need to modify the key (‘CORPNET_VLAN’) value in dict1 with the value of a key (“corporate_vlan”) from dict2, if the value of another key (“groups”) in dict2 (list of values) contains a certain string (“corp”). Is there a way like using dictionary comprehension to do it?
These are the dictionaries:
<code>dict1 = {
"vars": {
'CORPNET_VLAN': '100',
'BYOD_VLAN': '101',
'GUEST_VLAN': '102',
'IOT_VLAN': '103',
}
}
dict2 = {
"id": "00001",
"corporate_vlan": "999",
"groups": {
'POC',
'CORP-OFFICE',
}
}
</code>
<code>dict1 = {
"vars": {
'CORPNET_VLAN': '100',
'BYOD_VLAN': '101',
'GUEST_VLAN': '102',
'IOT_VLAN': '103',
}
}
dict2 = {
"id": "00001",
"corporate_vlan": "999",
"groups": {
'POC',
'CORP-OFFICE',
}
}
</code>
dict1 = {
"vars": {
'CORPNET_VLAN': '100',
'BYOD_VLAN': '101',
'GUEST_VLAN': '102',
'IOT_VLAN': '103',
}
}
dict2 = {
"id": "00001",
"corporate_vlan": "999",
"groups": {
'POC',
'CORP-OFFICE',
}
}
2