python關鍵字和保留字
關鍵詞 (Keywords)
Keywords are the reserved words in Python programming language (and, any other programming languages like C, C++, Java, etc) whose meanings are defined and we cannot change their meanings. In python programming languages, keywords are the case sensitive.
關鍵字是Python編程語言(以及其他任何編程語言,如C,C ++,Java等)中的保留字,其含義已定義,我們無法更改其含義。 在python編程語言中,關鍵字區分大小寫。
Note: We cannot use any reserved words (which are known as Keywords) as an identifier (like a variable name, function name, etc).
注意 :我們不能使用任何保留字(稱為關鍵詞 )作為標識符(如變量名,函數名等)。
Python關鍵字列表 (Python keyword list)
Here is the list of Python keywords (the list can be varied based on the Python versions),
這是Python關鍵字的列表(該列表可以根據Python版本而有所不同),
In Python 2.5
在Python 2.5中
and del from not while
as elif global or with
assert else if pass yield
break except import print
class exec in raise
continue finally is return
def for lambda try
In Python 3.8.1
在Python 3.8.1中
False None True and as
assert async await break class
continue def del elif else
except finally for from global
if import in is lambda
nonlocal not or pass raise
return try while with yield
Read: Python program to print the list of all keywords
閱讀: Python程序打印所有關鍵字的列表
Reference: https://docs.python.org/2.5/ref/keywords.html
參考: https : //docs.python.org/2.5/ref/keywords.html
翻譯自: https://www.includehelp.com/python/python-keywords.aspx
python關鍵字和保留字