formatter = "%r %r %r %r"
print formatter % (1,2,3,4)
print formatter % ("one","two","three","four")
print formatter % (True,False,False,True)
print formatter % (formatter,formatter,formatter,formatter)
print formatter %(
"I had this thing.",
"That you could type up right.",
"But it didn't sing.",
"So I said goodnight."
)
给出输出结果为
又是一种新的 print 用法格式
挺好,挺好
===========================================================================================================
附加练习
2单双引号的工作原理?
最后通用单引号,如果内有单引号的时候才用双引号。did't这里有个单引号了,所以那句话是双引号
注意字符串一般用%s,避免用%r。
%r是给调试的时候用的