知识点:
更复杂的打印
给出字符串格式多为变量,formatter = "{} {}"
输出print(formatter.format(内容,内容)
P.S.
为什么“one”用引号,False不用:True和False是Python关键字.
程序:
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"
))
输出:
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"
))