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

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                # Python 關鍵字和標識符 > 原文: [https://www.programiz.com/python-programming/keywords-identifier](https://www.programiz.com/python-programming/keywords-identifier) #### 在本教程中,您將學習關鍵字(Python 中的保留字)和標識符(變量,函數等的名稱)。 ## Python 關鍵字 關鍵字是 Python 中的保留字。 我們不能將關鍵字用作[變量](/python-programming/variables-datatypes)名稱,[函數](/python-programming/function)名稱或任何其他標識符。 它們用于定義 Python 語言的語法和結構。 在 Python 中,關鍵字區分大小寫。 Python 3.7 中有 33 個關鍵字。 隨著時間的推移,此數字可能會略有不同。 除`True`,`False`和`None`之外的所有關鍵字均使用小寫字母,并且必須照原樣書寫。 所有關鍵字的列表如下。 | | | | | | | --- | --- | --- | --- | --- | --- | | `False` | `await` | `else` | `import` | `pass` | | `None` | `break` | `except` | `in` | `raise` | | `True` | `class` | `finally` | `is` | `return` | | `and` | `continue` | `for` | `lambda` | `try` | | `as` | `def` | `from` | `nonlocal` | `while` | | `assert` | `del` | `global` | `not` | `with` | | `async` | `elif` | `if` | `or` | `yield` | 一次查看所有關鍵字并試圖弄清它們的含義可能不勝枚舉。 如果要進行概述,請參見以下所有關鍵字的完整[列表和示例。](/python-programming/keyword-list) * * * ## Python 標識符 標識符是給諸如類,函數,變量等實體的名稱。它有助于將一個實體與另一個實體區分開。 ### 編寫標識符的規則 1. 標識符可以是小寫(a 至 z)**或大寫**(A 至 Z)**或數字**(0 至 9)或下劃線`_`。 諸如`myClass`,`var_1`和`print_this_to_screen`之類的名稱都是有效的示例。 2. 標識符不能以數字開頭。`1variable`無效,但是`variable1`是有效名稱。 3. 關鍵字不能用作標識符。 ```py global = 1 ``` **輸出** ```py File "<interactive input>", line 1 global = 1 ^ SyntaxError: invalid syntax ``` 4. 我們不能使用像`!, @, #, $, %`**這樣的特殊符號**! ```py a@ = 0 ``` **輸出** ```py File "<interactive input>", line 1 a@ = 0 ^ SyntaxError: invalid syntax ``` 5. 標識符可以是任何長度。 * * * ### 要記住的事情 Python 是區分大小寫的語言。 這意味著`Variable`和`variable`不同。 始終給標識符一個有意義的名稱。 盡管`c = 10`是一個有效的名稱,但編寫`count = 10`會更有意義,并且在經過一段較??長的間隔后查看代碼時,更容易弄清楚它代表什么。 可以使用下劃線分隔多個單詞,例如`this_is_a_long_variable`。
                  <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>

                              哎呀哎呀视频在线观看