<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # 習題 12: 提示別人 當你鍵入 raw_input() 的時候,你需要鍵入 ( 和 ) 也就是“括號(parenthesis)”。這和你格式化輸出兩個以上變量時的情況有點類似,比如說 "%s%s"%(x,y) 里邊就有括號。對于 raw_input 而言,你還可以讓它顯示出一個提示,從而告訴別人應該輸入什么東西。你可以在 () 之間放入一個你想要作為提示的字符串,如下所示: ~~~ y = raw_input("Name? ") ~~~ 這句話會用 “Name?” 提示用戶,然后將用戶輸入的結果賦值給變量 y。這就是我們提問用戶并且得到答案的方式。 也就是說,我們的上一個練習可以使用 raw_input 重寫一次。所有的提示都可以通過raw_input 實現。 <table class="highlighttable"><tbody><tr><td class="linenos"> <div class="linenodiv"> <pre>1&#13; 2&#13; 3&#13; 4&#13; 5&#13; 6</pre> </div> </td> <td class="code"> <div class="highlight"> <pre>age = raw_input("How old are you? ")&#13; height = raw_input("How tall are you? ")&#13; weight = raw_input("How much do you weigh? ")&#13; &#13; print "So, you're %r old, %r tall and %r heavy." % (&#13; age, height, weight)&#13; </pre> </div> </td> </tr></tbody></table> ### 你應該看到的結果 ~~~ $ python ex12.py How old are you? 35 How tall are you? 6'2" How much do you weight? 180lbs So, you're '35' old, '6\'2"' tall and '180lbs' heavy. $ ~~~ ### 加分習題 1. 在命令行界面下運行你的程序,然后在命令行輸入 pydocraw_input 看它說了些什么。如果你用的是 Window,那就試一下 python-mpydocraw_input 。 1. 輸入 q 退出 pydoc。 1. 上網找一下 pydoc 命令是用來做什么的。 1. 使用 pydoc 再看一下 open, file, os, 和 sys 的含義。看不懂沒關系,只要通讀一下,記下你覺得有意思的點就行了。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看