如何用Python判断一个标识符word是不是保留字?答:方法1: 在IDLE里输入这个词,如果是保留字,则保留字会变橙色,给保留字赋值运行后也会报错 方法2:import keyword keyword.kwlist 输入结果:['False', 'None', 'True', 'and', 'as', 'assert', 'async', 'await', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else'...
Python 3.5及以上版本的保留字总数是多少?答:['False', 'None', 'True', 'and', 'as', 'assert', 'async', 'await', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'finally', 'for', 'from', 'global', 'if'