1 2 3 4 5 6 7 8 9 10
| # 方式一 # val = {"host": ip, "ttl": 60 } # cmd_string = f"/bin/etcdctl put /coredns/{flag} '{json.dumps(val)}'" # 方式二 # cmd_string = """/bin/etcdctl put /coredns/{flag} '{{"host": "{ip}","ttl": 60}}'""".format(flag=flag, ip=ip) # 方式三 # cmd_string = """/bin/etcdctl put /coredns/{0} '{{"host": "{1}","ttl": 60}}'""".format(flag, ip) # 方式四 # cmd_string = f"""/bin/etcdctl put /coredns/{flag} '{{"host": "{ip}","ttl": 60}}'""" # print(cmd_string)
|