formatter ="{} {} {} {}"#字符串变量,其中字符串内容为{},大括号{}内可以引用内容。print(formatter.format(1,2,3,4))#打印,应用format()函数格式化内容为至{},并打印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"))
输出结果
1234
one two three four
TrueFalseFalseTrue{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}
Try your Own text here Maybe a poem Or a song about fear