【问题标题】:Continue after running help() in Python interactive session在 Python 交互式会话中运行 help() 后继续
【发布时间】:2018-09-06 20:55:31
【问题描述】:

我在 Python 交互会话中运行以下代码并尝试从 json 获取有关“加载”方法的帮助,但我不知道在 (END) 之后继续我的指令,

这是我的代码:

import json
help(json.load)

这是我得到的:

...
 result of any object literal decode (a ``dict``). The return value of
    ``object_hook`` will be used instead of the ``dict``. This feature
    can be used to implement custom decoders (e.g. JSON-RPC class hinting).

    ``object_pairs_hook`` is an optional function that will be called with the
    result of any object literal decoded with an ordered list of pairs.  The
    return value of ``object_pairs_hook`` will be used instead of the ``dict``.
    This feature can be used to implement custom decoders.  If ``object_hook``
    is also defined, the ``object_pairs_hook`` takes priority.

    To use a custom ``JSONDecoder`` subclass, specify it with the ``cls``
    kwarg; otherwise ``JSONDecoder`` is used.
(END)

你能帮忙在(END)之后如何继续吗? (因为我无法输入下一条指令。)

【问题讨论】:

  • 键入q 命令?
  • 从长远来看,它将帮助您了解何时处于“寻呼机”应用程序中,并了解您的键绑定。

标签: python pagination tty pydoc


【解决方案1】:

q 获取quit。

我找不到这个documented,但是here it is in the source code of pydoc's pager

注意: (END) 文本暗示 pydoc 可能会委托给另一个程序 less,以便在您的平台上进行分页。但是,应该使用相同的快捷键。

【讨论】:

  • 实际上在我的系统上,它只是在运行less
  • 也许您已将 PAGER 环境变量设置为 less
  • PAGER 未设置。
  • pydoc.getpager() 中有一些可怕的代码,它有条件地检查 less 是否可执行。
  • 做一个man man 应该告诉你PAGER 的默认值。在我的系统上它是/usr/bin/less -is,但它会因安装而异。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2020-02-14
  • 2010-10-29
  • 2018-07-13
  • 1970-01-01
  • 2017-02-07
  • 2012-07-12
  • 2010-10-31
相关资源
最近更新 更多