笨方法学python-练习8-更多更多打印

2017-02-11  本文已影响0人  Demoary

练习8-更多更多打印

更多打印

# -*- coding:utf-8 -*-
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."
)

运行结果

PS F:\python大师\习题> python .\ex8.py
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 didn't sing." 'So I said goodnight.'
PS F:\python大师\习题> 
上一篇下一篇

猜你喜欢

热点阅读