【问题标题】:IPython qtconsole ignores PromptManager changeIPython qtconsole 忽略 PromptManager 更改
【发布时间】:2013-05-03 22:15:23
【问题描述】:

我编辑了ipython_qtconsole_config.py 以包含时间戳:

import datetime
c = get_config()
c.PromptManager.in_template = '%s In [\\#]: ' % datetime.datetime.now().strftime("%H:%M:%S")

当我在 shell 中键入 config PromptManager 时,我看到我的更改已完成,但没有显示时间戳。我该如何解决这个问题?

【问题讨论】:

    标签: ipython qtconsole


    【解决方案1】:

    qtconsole 提示符不支持常规 IPython 提示符的大部分功能(即an open issue)。可配置的也不同。

    默认值:

    c.IPythonWidget.in_prompt = 'In [<span class="in-prompt-number">%i</span>]: '
    

    你可以改变它:

    c.IPythonWidget.in_prompt = '<b><i>My Prompt </i>[%i]: </b>'
    

    当问题得到解决后,它的行为应该完全符合您的预期。

    【讨论】:

    • 谢谢,这行得通。不幸的是,IPython 只显示它启动的时间,并且不会更新每一行的时间戳。这里的解决方案似乎不起作用stackoverflow.com/questions/3879752/…
    猜你喜欢
    • 1970-01-01
    • 2016-10-23
    • 1970-01-01
    • 1970-01-01
    • 2014-08-11
    • 2014-11-03
    • 1970-01-01
    • 1970-01-01
    • 2012-06-05
    相关资源
    最近更新 更多