my_formatter = "%r %r %r %r" print my_formatter % (1, 2, 3, 4) print my_formatter % ("one", "two", "three", "four") print my_formatter % (True, False, False, True) print my_formatter % (my_formatter, my_formatter, my_formatter, my_formatter) print my_formatter % ( "I had this thing.", "That you could type up right.", "But it don't sing.", "So I said goodnight." )
输出为:
1 2 3 4
'one' 'two' 'three' 'four'
True False False True
'%r %r %r %r' '%r %r %r %r' '%r %r %r %r' '%r %r %r %r'
'I had this thing.' 'That you could type up right.' "But it don't sing." 'So I said goodnight.'
因为标红的部分已包含一个单引号,则输出用双引号括起来,其余都是用单引号