2019-04-06 | python | UNLOCK

Python关键字


1
2
3
>>> import keyword  
>>> keyword.kwlist
['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']

内置变量 False None True

逻辑与或非 and or not

判断 与 循环 if elif else is in for while break continue

函数 def lamda pass return yield

异常处理 try except finally raise assert

导入模块 包 import from

重命名 as

变量 global nonlocal

类 class

删除 del

上下文管理 with

异步 async await

评论加载中