Pycharm:只运行我的 Python 文件的一部分 [英] Pycharm: run only part of my Python file

查看:121
本文介绍了Pycharm:只运行我的 Python 文件的一部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在 PyCharm 中只运行程序的一部分?

Is it possible to run only a part of a program in PyCharm?

在其他编辑器中,我可以运行类似单元格的东西,但在 PyCharm 中找不到这样的选项?

In other editors there is something like a cell which I can run, but I can't find such an option in PyCharm?

如果这个函数不存在,那对我来说将是一个巨大的缺点......因为对于我的数据分析,我经常只需要运行我的代码的最后几行.

If this function doesn't exist it would be a huge drawback for me... Because for my data analysis I very often only need to run the last few lines of my code.

推荐答案

我找到了一个更简单的方法.

I found out an easier way.

  • 转到文件 -> 设置 -> 键盘映射
  • 搜索 Execute Selection in Console 并将其重新分配给新的快捷方式,例如 Crl + Enter.
  • go to File -> Settings -> Keymap
  • Search for Execute Selection in Console and reassign it to a new shortcut, like Crl + Enter.

这是在 Spyder 和 R-Studio 中执行相同操作的相同快捷方式.

This is the same shortcut to the same action in Spyder and R-Studio.

这篇关于Pycharm:只运行我的 Python 文件的一部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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