petit_herisson

导航

Exercise 8 - printing, printing

 

formatter = "%r %r %r %r"

print(formatter % (1,2,3,4))
print(formatter % ("one", "two", "three", "four"))
print(formatter % (True, False, True, False))
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."
))

output

1 2 3 4
'one' 'two' 'three' 'four'
True False True False
'%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.'

 

2019-09-26

21:27:37

posted on 2019-09-26 17:28  petit_herisson  阅读(81)  评论(0)    收藏  举报