我在使用嵌套循环的这段代码中
res1 = EC2_CLIENT.describe_instances(
InstanceIds=[ec2_id,
],
)['Reservations']
print (res1)
for r in res1:
inst = r['Instances']
for i in inst:
ni = i['NetworkInterfaces']
for n in ni:
g = n['Groups']
for g1 in g:
groupId = g1['GroupId']`
有没有一种方法可以简化这段代码来检索groupId?