Spyder 中的 Outline Explorer 是什么?

What is Outline Explorer in Spyder?

我看到它被引用了,但从未解释过它是什么。

https://docs.spyder-ide.org/editor.html

用谷歌搜索没有成功。

https://docs.spyder-ide.org/editor.html "Providing a description to the right of the separator will give that cell its own name in the Outline Explorer." 听起来像是导航单元格?我在哪里可以找到它?是否有用于导航您创建的单元格的快捷方式?

谢谢!

在您的代码中,您可以使用它,例如在 Spyder 中,在每个函数之前(每个函数的上面一行)写#%%,您将在 gui 中看到不同之处,您会发现该块位于 cell/it 概述。

并在大纲中 window(启用视图 > 窗格 > 大纲)您将在代码中看到每个块和大纲

我认为 Outline Explorer 旨在促进在长 and/or 密集 Python 脚本中的导航。一眼就可以看到脚本的结构,您可以通过单击直接转到概述的任何内容。

据我目前所见,Outline Explorer 中显示的概述元素是:

  • 在编辑器中选择的脚本名称[Python徽标]
  • 功能[黄色f标志]
  • classes[蓝色C标志]
  • inside classes : __init__ [粉色 _ 标志], 方法 [绿色 M 徽标]
  • 内部函数和class方法:循环(for,while...),条件 (if-elif-else, try-except...)
  • 细胞(参见
  • if __name__ == '__main__' :(允许 "when your script is run by passing it as a command to the Python interpreter, all of the code that is at indentation level 0 gets executed"
  • 评论[灰色#标志](见下文)

要显示注释标记:写 #### YourComment。四个哈希和文本之间的 space 很重要;该代码适用于四个或更多哈希值。

"YourComment" 将出现在您的 Outline 资源管理器中。如果它在一个单元格中,它将保留在同一个单元格中。我为字幕使用注释标记,有时用于标记我必须重新编写一些代码的地方。

您可以继续您的代码开头,然后按 ctrl+shift+End 并在 select 一切之后 运行 F9