python的关键字有哪些
程序员文章站
2022-03-19 15:40:56
...
在python中若想查询python中有哪些关键字。
可以先导入keyword模块
import keyword #导入关键字模块 print(keyword.kwlist) #查询所有关键字
查询结果:
['False', 'None', 'True', 'and', 'as', 'assert', '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']
如果将关键字作为标识符,则会出现以下报错:
and= [1,2,1,3] print(and) File "E:/Selenium_Study/111.py", line 34 and= [1,2,1,3] ^ SyntaxError: invalid syntax
以上就是python的关键字有哪些的详细内容,更多请关注其它相关文章!
上一篇: c++中string的用法介绍
下一篇: python中elif可以单独使用吗
推荐阅读
-
有哪些你不知道的Python小工具
-
C#/.NET/.NET Core定时任务调度的方法或者组件有哪些--Timer,FluentScheduler还是...
-
php 函数当中实现相同功能但是速度有差异的有哪些,为什么速度会有差异?
-
python检测文件夹变化,并拷贝有更新的文件到对应目录的方法
-
Python的主要应用领域有哪些?Python的介绍
-
有哪些大型公司在使用 Python?有哪些知名项目是主要由 Python 写成的?
-
python有证书的加密解密实现方法
-
mysql - php在linux后台定时运行的脚本有哪些?
-
javascript中常用的事件有哪些
-
微信小程序有哪些小程序可以预订酒店?可以预订酒店的微信小程序汇总