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."
)
你看到結(jié)果
$ python ex8.py
1234'one''two''three''four'TrueFalseFalseTrue'%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 didn't sing."'So I said goodnight.'
更多建議: