Search code examples
pythonvisual-studio-code

How do I use the Debug Console in VS Code?


I really like the Debug Console feature in VS Code, it makes it a lot easier for me to do Python writing. How do I get it to stay on? Is it possible to write launch.json so that the code runs without closing the run afterwards?

I can use time.sleep() to continue this console on.

  • Can I edit the'launch.json'?
  • What are other ways?

Solution

  • The interactive window should work for you. Open an interactive window with the command Jupyter: Create Interactive Window

    enter image description here

    Or right-click on the code editor interface and select Run Current File in Python Interactive Window.

    enter image description here

    In this window, you can directly run the code file or write the code and then shift+enter to run.

    More details can be found in the documentation.