1

In VS Code, I'm writing python code. I was wondering if there is a key shortcut to run the file instead of pressing the run button in the right top corner of the screen constantly.

erwindenboer
  • 111
  • 1
  • 10
  • Does this answer your question? [How to execute Python code from within Visual Studio Code](https://stackoverflow.com/questions/29987840/how-to-execute-python-code-from-within-visual-studio-code) – zaibaq Apr 27 '22 at 08:54
  • what does the official VSC doc say about Python – rioV8 Apr 27 '22 at 09:37

3 Answers3

3

You can press Ctrl + F5 to run the file.

If you want to debug the file, use F5 instead.

cycool29
  • 78
  • 7
2

You can refer to the picture below to find the shortcut key and change it according to your needs.

enter image description here

enter image description here

MingJie-MSFT
  • 5,569
  • 1
  • 2
  • 13
1

For anyone googling, this was my approach that has worked rather well

CTRLK + CTRLS brings the Keyboard Shortcuts menu.

keyboard shortcuts

At the top, in the search bar, type run python file.

enter image description here

From there, you can add a keybind to the Run Python File tag.

Nolan Pestano
  • 47
  • 1
  • 6