<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>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                # 練習2.注釋和井號“#” 注釋在編程中是很重要的部分。它能告訴你這段代碼是干什么用的,或者用來刪除一部分你暫時不需要執行的代碼。下面演示的是如何在python中使用注釋: ~~~ # A comment, this is so you can read your program later. # Anything after the # is ignored by python. print "I could have code like this." # and the comment after is ignored # You can also use a comment to "disable" or comment out a piece of code: # print "This won't run." print "This will run." ~~~ 從現在開始,我將使用帶注釋的編寫代碼。你要明白,不是所有的東西都有文字說明的。你的屏幕和程序可能看起來不太一樣,不過,最重要的應該是你輸入到文件中的內容。事實上,我可以使用任意的文本編輯器編寫這些代碼,并且保證他們的執行結果都是一樣的。 ## 你應該看到的結果 ~~~ $ python ex2.py I could have code like this. This will run. ~~~ 同樣,我不會告訴你所有可能的終端的屏幕截圖.你應該明白,上面的文字并不是你的輸出結果的樣子,而是在你的命令行`$ python ...`以及最后一個`$` 之間的文字內容。 ## 附加題 > 1.弄清楚”#”號的作用,并且記住它的名字。(中文為井號,英文為 octothorpe 或者 pound character)。2.打開你的 ex2.py文件,從后往前逐行檢查。從最后一行開始,倒著逐個單詞單詞檢查回去。3.有沒有發現什么錯誤?有的話就修復它們。4.大聲朗讀你寫的代碼,把每個字符都讀出來。有沒有發現更多的錯誤呢?有的話也一樣改正過來。 ## 常見問題 ### Q:你確定`#`被稱為pound character? > 我把它叫做octothorpe是因為它是唯一一個沒有國家采用,但卻在每個國家使用的名字。每個國家都認為注釋符的名字應該有如下特性:既是最重要的注釋方法也是唯一的注釋方法。對我來說,這是一個很無聊的問題,你應該將精力集中在更重要的事情上,比如學習如何編程上。 ### Q:如果`#`是注釋的話,那么`# -*- coding: utf-8 -*-`是怎么運行的? > Python仍然會忽略這句代碼,但是它卻可以作為“黑客”或者解決問題的方法來制定文件的格式。你還可以在編輯器的設置中找到其他類似的注釋。 ### Q:為什么`print "Hi # there."`這句中的`#`沒有被忽略 > 這句代碼中的`#`是包含在字符串中的,字符串直到遇到下一個`"`為止,字符串里的`#`只是當做一個字母而不是注釋處理。 ### Q:我怎樣注釋掉多行呢? > 在要注釋的每一行前面加上`#` ### Q:我不知道如何使用我們本國的鍵盤輸入`#` > 一些國家使用Alt鍵和其他鍵的組合來打印他們的語言文字。你得在網上搜索下你們國家的鍵盤如何輸入`#`。 ### Q:為什么要我從后向前閱讀代碼 > 這其實是一種欺騙你大腦的做法,這樣做能讓你的大腦沒有附加意義的理解每一部分代碼,同時能讓你正確的處理你的每一塊代碼。這是一個方便的捕獲錯誤,檢測錯誤的技術。
                  <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>

                              哎呀哎呀视频在线观看