【问题标题】:IPython 5.0: Remove spaces between input linesIPython 5.0:删除输入行之间的空格
【发布时间】:2016-07-29 07:14:23
【问题描述】:

(这个问题本质上是this question,但针对的是IPython 5.0版)

我想要 IPython 5.0 的经典提示。

This 问题有助于自定义我的提示。事实上,我发现 IPython 已经为 ClassicPrompts 定义了一个类。

我需要做的就是将以下内容放入一个名为 00-classic-prompts.py 的文件中或 ~/.ipython/profile_default/startup/ 中的某个文件中:

from IPython.terminal.prompts import ClassicPrompts

ip = get_ipython()
ip.prompts = ClassicPrompts(ip)

但不同的提示行仍然呈现为:

>>> print('Hello world!')
Hello world!

>>> 

在每个输入提示之前都有一个额外的换行符。我怎样才能删除它?

【问题讨论】:

    标签: python ipython prompt


    【解决方案1】:

    请将此行附加到现有启动脚本的底部:

    ip.separate_in = ''
    

    这是documented feature,但目前没有描述,因此很难找到。

    【讨论】:

    • @wim 供将来参考,这是否记录在某处?我尝试查看他们的new docs website,但一无所获。谢谢!
    猜你喜欢
    • 1970-01-01
    • 2023-02-15
    • 1970-01-01
    • 2015-05-30
    • 2014-01-11
    • 2023-03-15
    • 1970-01-01
    • 2021-07-17
    • 1970-01-01
    相关资源
    最近更新 更多