我刚开始学习 Python,并在交互模式下对不同的 String 方法使用 help() 函数。 例如:
>>> S = 'abcd'
>>> help(S.isdigit)
输出符合预期:
Help on built-in function isdigit:
isdigit(...)
S.isdigit() -> bool
Return True if all characters in S are digits
and there is at least one character in S, False otherwise.
(END)
不幸的是,无论我按什么按钮,我似乎都无法退出此提示(CTRL+D 也不起作用)。 我可以关闭终端,但这显然很麻烦。
我使用的是 Ubuntu 16.04 LTS。
提前感谢您的任何建议!
请您参考如下方法:
在 Python 的交互式 shell 中输入 help 调用 pydoc .
When printing output to the console,
pydocattempts to paginate the output for easier reading. If thePAGERenvironment variable is set,pydocwill use its value as a pagination program.
除非您以其他方式配置它,否则 pydoc 可能使用 less .在这种情况下,按 Q 退出。
注意:许多程序使用 less 之类的键绑定(bind)。我会将 Q 添加到您的键盘命令列表中,以便在您不知道如何退出程序时尝试。
