Python 如何在 Jupyter Notebook 的“降价”单元格中获取制表符空间

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/47061626/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 17:59:32  来源:igfitidea点击:

How to get tab space in 'markdown' cell of Jupyter Notebook

pythonpandasjupyter-notebookipython-notebook

提问by Piyush Pallav

I am writing descriptive ipynb file and need to give output in markdown with space, but unable to add tab space for printing structured data.

我正在编写描述性的 ipynb 文件,需要在带有空格的降价输出中提供输出,但无法添加用于打印结构化数据的制表符空间。

回答by Piyush Pallav

  1. Type "nbsp" to add a single space.
  2. Type "ensp" to add 2 spaces.
  3. Type "emsp" to add 4 spaces.
  4. Use the non-breaking space (nbsp) 4 times to insert a tab.
  1. 键入“nbsp”以添加一个空格。
  2. 键入“ensp”以添加 2 个空格。
  3. 键入“emsp”以添加 4 个空格。
  4. 使用不间断空格 (nbsp) 4 次以插入制表符。

eg.  This is an example.

例如。  This is an example.

回答by JeremyDouglass

If I understand your question then I don't think this has anything to do with Jupyter cells. For example, are you able to type a tab key into a Stackoverflow question box? Most browsers do not allow tab keys in most dialogs on most websites -- instead, tab switches to the next area.

如果我理解你的问题,那么我认为这与 Jupyter 细胞没有任何关系。例如,您能否在 Stackoverflow 问题框中键入 Tab 键?大多数浏览器不允许在大多数网站的大多数对话框中使用 Tab 键——相反,Tab 键切换到下一个区域。

Some options:

一些选项:

  1. cut a tab from a text application, paste into a Jupyter cell. (works)
  2. try using a browser-specific extension, like TabMeansTabfor Chrome or Tabintafor Firefox.
  1. 从文本应用程序中剪切一个选项卡,粘贴到 Jupyter 单元格中。(作品)
  2. 尝试使用特定于浏览器的扩展程序,例如适用于 Chrome 的TabMeansTab适用于 Firefox 的Tabinta

See also further discussions of typing tab keys in browsers in generalon SuperUser:

另请参阅SuperUser上一般在浏览器键入 Tab 键的进一步讨论:

回答by pentandrous

I just had this problem and resorted to the following:

我刚刚遇到了这个问题并采取了以下措施:

This is text with $\;\;\;\;\;\;$some space inserted.

这是$\;\;\;\;\;\;$插入了一些空格的文本。