问题描述
在以前的Spyder版本中,您可以在编辑器中选择行,并且仅运行选定的行.在Spyder的4中,当选择线,然后按 + 它执行其执行整个代码.
In previous versions of Spyder, you can select lines in the editor, and only run the selected lines. In Spyder 4, when you select lines and press + it executes runcell(0, '/your/dir/file.py')
which executes the whole code.
如何仅运行所选行?
推荐答案
用于运行光标所在行或Spyder 4中当前选择的行的热键为. + 将运行当前的单元格.您可以在Spyder的此处了解更多信息.基本上,这些是可以在编辑器中使用代码中的特定语法定义的代码块,并且可以由Spyder和其他IDE独立运行.
The hotkey for running a the line at which the cursor is, or the currently selected lines in Spyder 4 is . + will run the current cell. You can read more about cells in Spyder here. Basically, these are blocks of code that can be defined in the editor using a specific syntax within the code, and can be run independently by Spyder and other IDEs.
顺便说一句, + 是在R Studio(而不是Spyder)中运行当前行的键盘快捷键.
Incidentally, + is the keyboard shortcut for running the current line in R Studio, not Spyder, which may be where you got it confused.
这篇关于如何仅运行Spyder 4中当前选择的行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!