import keyword
print(keyword.kwlist)
用Python3.9跑,输出为:
['False', 'None', 'True', '__peg_parser__', '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']
有一个彩蛋是__peg_parser__
用Python运行会看到:
File "E:\python_class\main.py", line 335
__peg_parser__
^
SyntaxError: You found it!
这显然不是普通的语法错误~~~
(注:只有Python3.9有这个彩蛋, 3.8和3.10都没有)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)