Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pycharm: run only part of my Python file

Tags:

python

pycharm

Is it possible to run only a part of a program in 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.

like image 581
FrankTheTank Avatar asked May 03 '14 07:05

FrankTheTank


People also ask

How do I run an individual Python file in PyCharm?

Any Python file shown in your folder can be run by right/control clicking on it and selecting in the dropdown menu: Run <name of file without . py> Alternately you can click on the top menu item Run, and in the dropdown menu click on Run... and the current file should appear there. You can click on it.


1 Answers

I found out an easier way.

  • go to File -> Settings -> Keymap
  • Search for Execute Selection in Console and reassign it to a new shortcut, like Crl + Enter.

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

like image 162
Willian Adamczyk Avatar answered Oct 01 '22 22:10

Willian Adamczyk