程序代码:


formatter = "{} {} {} {}"

print(formatter.format("1","2","3","4"))
print(formatter.format("one", "two", "three", "four"))
print(formatter.format(True, False, False, True))
print(formatter.format(formatter, formatter, formatter, formatter))
print(formatter.format(
    "Try your"
    "Own text here",
    "Maybe a poem",
    "Or a song about fear."
))

输出结果:


1 2 3 4
one two three four
True False False True
{} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}
Try your Own text here Maybe a poem Or a song about
fear.
最后修改:2021 年 03 月 05 日
如果觉得我的文章对你有用,请随意赞赏