每次运行.py文件都要去点右上角的三角形按钮,特别麻烦

参考https://stackoverflow.com/questions/29987840/how-to-execute-python-code-from-within-visual-studio-code/38995516#38995516,使用VSCode插件Code Runner之后可以使用Ctrl + Alt + N来运行python文件。
但是你安装了Code Runner之后会发现它会直接输出到日志

而并不会输出print的内容。
需要在setting那里勾选这个

勾了之后就可以用Ctrl + Alt + N然后还Run in Terminal了。

但是在使用快捷键运行之前需要按Ctrl+S进行保存,毕竟本质上是python -u 文件.py
网友评论