<span id="7ztzv"></span>
<sub id="7ztzv"></sub>

<span id="7ztzv"></span><form id="7ztzv"></form>

<span id="7ztzv"></span>

        <address id="7ztzv"></address>

            習題 8: 打印,打印?

             1
             2
             3
             4
             5
             6
             7
             8
             9
            10
            11
            12
            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."
            )
            

            你應該看到的結果?

            $ 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.'
            $
            

            加分習題?

            1. 自己檢查結果,記錄你犯過的錯誤,并且在下個練習中盡量不犯同樣的錯誤。
            2. 注意最后一行程序中既有單引號又有雙引號,你覺得它是如何工作的?

            Project Versions

            Table Of Contents

            Previous topic

            習題 7: 更多打印

            Next topic

            習題 9: 打印,打印,打印

            This Page

            <span id="7ztzv"></span>
            <sub id="7ztzv"></sub>

            <span id="7ztzv"></span><form id="7ztzv"></form>

            <span id="7ztzv"></span>

                  <address id="7ztzv"></address>

                      亚洲欧美在线