Run Python in VSCode in python shell like IDLE

帅比萌擦擦* 提交于 2020-07-09 17:44:12

问题


I am well aware of the thread How to execute Python code from within Visual Studio Code

But none of them shows how to get the >>> python shell running with the file imported. Cuz I would like to call functions separately. I understand that I can get the python shell going by simply typling python in the terminal but the functions in the python file have to manually imported everytime.

Is there a way to run files in VSCode like in IDLE?


回答1:


you can run the file in an interactive mode in VSC code terminal by using the parameter -i : python -i py_file.py




回答2:


Assuming you have the official Python extension installed, you can search the command list (Ctrl+Shift+P) for "Python interactive" and you'll see several options that allow to do different variations of this:



来源:https://stackoverflow.com/questions/58557135/run-python-in-vscode-in-python-shell-like-idle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!