为什么内置的python帮助功能不能显示所有可能的命令?

时间:2018-01-08 00:11:08

标签: python arrays python-3.x list

我正在寻找一个可以用来删除数组中特定元素的命令。所以我决定使用内置的help()函数。

help([1,2,3,4,5,6,7,8,9])

这样做的结果是我能够找到remove()函数,但却没有提到del关键字,结果证明它很有用。

是否有类似help()的类似功能也可以输出del等关键字?

1 个答案:

答案 0 :(得分:2)

在某种程度上,你问题的答案就在你的问题中。 3141213511213142214421511411141211121213 Character '1' is in result: 20 times = 50.0% Character '2' is in result: 8 times = 20.0% Character '3' is in result: 4 times = 10.0% Character '4' is in result: 6 times = 15.0% Character '5' is in result: 2 times = 5.0% dacadaabaaebeadaadaaccacaaadadbaabddaababdacbaadaaceaeaabaacabdaabcaaadabbbbabab Character 'a' is in result: 40 times = 50.0% Character 'b' is in result: 16 times = 20.0% Character 'c' is in result: 8 times = 10.0% Character 'd' is in result: 12 times = 15.0% Character 'e' is in result: 4 times = 5.0% qqetweqrrwqqwqqqqqqwqerqqqwqeqwqwqwqqqqrqwqwrqqqqwwqqqqqqrqrreqqrrqqqqeqwreqtqtrqwetewrwqqtrwewqrwwq Character 'q' is in result: 50 times = 50.0% Character 'w' is in result: 20 times = 20.0% Character 'e' is in result: 10 times = 10.0% Character 'r' is in result: 15 times = 15.0% Character 't' is in result: 5 times = 5.0% 位于remove()中是正确的,因为help()函数显示内置于Python的函数。但是,help()不是函数。它是一个关键字。关键字是Python语法的一部分,因此有关这些的信息只能在文档或其他在线教程中。由于delhelp()def不在while函数中的相同原因,它不在if函数中。它们是Python语言的一部分,并添加了help(),并且是所有Python发行版中包含的主模块的一部分。