Python字符串替换占位符
s = "{0}-{1},{2}".format("zhang", 2018, 2019)
print(s)
s = "{name},{year}-{net}".format(name="phil", year=2019, net="")
print(s)
s = "{name},{0}".format(2019, name="zhangphil")
print(s)
运行输出:
zhang-2018,2019
phil,2019-
zhangphil,2019