在IPython / Jupyter笔记本中显示行号 [英] Showing line numbers in IPython/Jupyter Notebooks

查看:137
本文介绍了在IPython / Jupyter笔记本中显示行号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在IPython / Jupyter笔记本中运行的大多数语言内核的错误报告指示发生错误的行;但是(至少在默认情况下)笔记本中没有显示行号。

Error reports from most language kernels running in IPython/Jupyter Notebooks indicate the line on which the error occurred; but (at least by default) no line numbers are indicated in Notebooks.

是否可以将行号添加到IPython / Jupyter笔记本中?

Is it possibile to add the line numbers to IPython/Jupyter Notebooks?

推荐答案

CTRL - M L 切换CodeMirror中的行号区域。有关其他键盘快捷键的信息,请参阅QuickHelp。

CTRL - ML toggles line numbers in the CodeMirror area. See the QuickHelp for other keyboard shortcuts.

更多详细信息 CTRL - M (或 ESC )进入命令模式,然后按 L 键应切换当前单元格行号的可见性。在最近的笔记本版本中, Shift-L 应切换所有单元格。

In more details CTRL - M (or ESC) bring you to command mode, then pressing the L keys should toggle the visibility of current cell line numbers. In more recent notebook versions Shift-L should toggle for all cells.

如果您忘记了快捷方式,请调出命令面板 Ctrl-Shift + P (Mac上的 Cmd + Shift + P ),并搜索行号),它应该允许切换并显示快捷方式。

If you can't remember the shortcut, bring up the command palette Ctrl-Shift+P (Cmd+Shift+P on Mac), and search for "line numbers"), it should allow to toggle and show you the shortcut.

这篇关于在IPython / Jupyter笔记本中显示行号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆