有没有办法在Jupyter笔记本中使用“交互”显示ANSI转义?

时间:2020-07-29 22:45:26

标签: jupyter-notebook jupyter-lab ipywidgets ansi-escape

我在Jupyter笔记本中使用interact,该函数的功能是返回带有某些ANSI转义符的文本,而这些文本未按要求显示。例如我有

steps = [step.display_text() for step in increasing_machine.steps(1000)]
@interact(s=(0,999,1))
def show_step(s=0):
    return steps[s]

其中display_text生成包含转义码的文本,我得到的结果类似于

'əə0 0 1 \x1b[44m\x1b[37;1m \x1b[0m\n        \x1b[44m\x1b[37;1mf\x1b[0m'

是否可以使用interact在Jupyter笔记本中显示ANSI转义?

0 个答案:

没有答案
相关问题