ENV:python3.7+,boto3
我有私有IP地址列表['10.0.3.11','10.0.2.22']
response = route53_client.change_resource_record_sets(
HostedZoneId="ABDCEFGH",
ChangeBatch={
'Comment': 'Dns to ec2 instance',
'Changes': [
{
'Action': 'UPSERT',
'ResourceRecordSet': {
'Name': "ts-uat",
'Type': 'A',
'TTL': 120,
'ResourceRecords': [
{
'Value': record['Value']
},
]
}
}
]
}
)
如何得到它如下
HostedZoneId="ABDCEFGH",
ChangeBatch={
'Comment': 'Dns to ec2 instance',
'Changes': [
{
'Action': 'UPSERT',
'ResourceRecordSet': {
'Name': "ts-uat",
'Type': 'A',
'TTL': 120,
'ResourceRecords': [
{
'Value': 10.0.3.11
},
{
'Value': 10.0.2.22
},
]
}
}
]
}
)
我尝试了以下方法
def getListofIP(n):
return "{'value' : %s,}" % (n)
result = map(getListofIP, private_ip)
print(list(result))
产量为
[“{'value':10.0.3.11,}”,“{'value':10.0.2.22,}”]
非常感谢WillRichardson。它对我有用
输出
相关问题 更多 >
编程相关推荐