I really like the debug console feature in VScode, 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?
It's not possible to keep the debug console open after the script ends, because the memory is released back to the operating system.
Edit: as @nigh_anxiety mentioned, setting a breakpoint at the end of the script is probably a more elegant solution.
Old Answer:
Instead, you could wait for user input before exiting, with a line like
input('press enter to quit')
at the end of your file.
The interactive window should work for you. Open an interactive window with the command Jupyter: Create Interactive Window
Or right-click on the code editor interface and select Run Current File in Python Interactive Window
.
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 .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.