Python关键字是python编程语言的保留字。这些关键字不能用于其他目的。
Python中有35个关键字-下面列出了它们的用法。
Keyword | Description | |
---|---|---|
and | A logical AND operator. Return True if both statements are True .
|
|
or | A logical OR operator. Returns True if either of two statements is true. If both statements are false, the returns False .
|
|
as | It is used to create an alias.
|
|
assert | It can be used for debugging the code. It tests a condition and returns True , if not, the program will raise an AssertionError.
|
|
async | It is used to declare a function as a coroutine, much like what the @asyncio.coroutine decorator does.
|
|
await | It is used to call async coroutine.
|
|
class | It is used to create a class.
|
|
def | It is used to create or define a function. |