I have the following python dictionary:
'load_balancers': {'App': {'DJMatcher': {'security_group': 'sg-618d1c05', 'service_name': 'djmatcher/svc', 'certificateId': 'net', 'health_check_path': '/djmatcherstatus/ma.html', 'DNS': {'fde': {'record_name': 'platform-enrichment-djmatcher', 'ttl': 60}}}}}
现在它基本上代表以下的YAML:
LoadBalancers:
App:
DJMatcher:
certificateId: 'net'
health_check_path: /djmatcherstatus/ma.html
security_group: *svc_sg1
service_name: *sn
DNS:
fde:
record_name: platform-enrichment-djmatcher
ttl: 60
我希望删除第二层键“App”,并保留其余部分,这意味着生成的Python字典应该变成这样,其中我删除了键“App”,但是值现在变为其父键“load_balancers”的值:
'load_balancers': {'DJMatcher': {'security_group': 'sg-618d1c05', 'service_name': 'djmatcher/svc', 'certificateId': 'net', 'health_check_path': '/djmatcherstatus/ma.html', 'DNS': {'fde': {'record_name': 'platform-enrichment-djmatcher', 'ttl': 60}}}}
有什么好的方法可以实现这个目标吗?