List and Dictionary Iteration

I have list (of dictionary) and dictionary in Python as below
List1= [ { ‘Id’: ‘i-0f76fasa’,‘Port’: 80,‘State’: ‘unavailable’,‘TargetGrnArn’ :‘ABC123’}
{ ‘Id’: ‘i-0f97wewr’,‘Port’: 88,‘State’: ‘unavailable’,‘TargetGrnArn’ :‘ABC123’}
{ ‘Id’: ‘i-0f12xrde’,‘Port’: 90,‘State’: ‘unavailable’,‘TargetGrnArn’ :‘XYZ234’}
{ ‘Id’: ‘i-0f26fade’,‘Port’: 90,‘State’: ‘unavailable’,‘TargetGrnArn’ :‘XYZ234’}]

Dict1={“TargetGroupName”:1245,“TargetGroupArn”: ABC123,“HealthCheckProtocol”:TCP,“HealthCheckPort”:22,“HealthCheckEnabled”:YES,“HealthCheckIntervalSeconds”:20,“HealthCheckTimeoutSeconds”:60,“HealthyThresholdCount”:3,“HealthCheckPath”:/tmp}

The requirement is TargetGrnArn is matched with List new list or dictionary should have 2 items with same values as in Dict1 in addition to values in List1.

final output requirement is
“TargetGroupName”:1245,“TargetGroupArn”: ABC123,“HealthCheckProtocol”:TCP,“HealthCheckPort”:22,“HealthCheckEnabled”:YES,“HealthCheckIntervalSeconds”:20,“HealthCheckTimeoutSeconds”:60,“HealthyThresholdCount”:3,“HealthCheckPath”:/tmp ,‘Id’: ‘i-0f76fasa’,‘Port’: 80,‘State’: ‘unavailable’}
“TargetGroupName”:1245,“TargetGroupArn”: ABC123,“HealthCheckProtocol”:TCP,“HealthCheckPort”:22,“HealthCheckEnabled”:YES,“HealthCheckIntervalSeconds”:20,“HealthCheckTimeoutSeconds”:60,“HealthyThresholdCount”:3,“HealthCheckPath”:/tmp , ‘Id’: ‘i-0f97wewr’,‘Port’: 88,‘State’: ‘unavailable’}

Here Information in Dict1 will remain same in both the items but rest information from list will be different.

What problem are you having with it?

if you want it to stay the same and not change you can use the tuple method.