有没有可能只用 PyCharm 运行程序的一部分?
在其他编辑器中,有一个类似于单元格的东西,我可以运行它,但是我在 PyCharm 中找不到这样的选项?
如果这个函数不存在,对我来说将是一个巨大的缺点... ... 因为对于我的数据分析,我通常只需要运行代码的最后几行。
You can select a code snippet and use right click menu to choose the action "Execute Selection in console".
You can set a breakpoint, and then just open the debug console. So, the first thing you need to turn on your debug console:
After you've enabled, set a break-point to where you want it to:
After you're done setting the break-point:
Once that has been completed:
Pycharm shortcut for running "Selection" in the console is ALT + SHIFT + e
For this to work properly, you'll have to run everything this way.
I found out an easier way.
Execute Selection in Console
This is the same shortcut to the same action in Spyder and R-Studio.
PyCharm cell mode
Run Cell
Run Cell and go to next
A cell is delimited by ##
Ref https://plugins.jetbrains.com/plugin/7858-pycharm-cell-mode
There is an option that you can run jupyter notebook file and its cells in pycharm. For more information visit Run and debug Jupyter notebook code cells in pycharm.