如何执行运行 Shift + Enter 仅选择 vscode 中突出显示的代码行?
编辑:也许我应该更清楚。
按 Shift + Enter 时出现以下错误:Unable to initialize device PRN
但是当我右键单击 > 在终端中运行 python 文件时,代码有效。
最佳答案
Select one or more lines, then press Shift+Enter or right-click and select Run Selection/Line in Python Terminal. This command is convenient for testing just a part of a file.
这就是 VS Code documentation 上的内容对于 Python,这对我有用。是
Shift + Enter
不是 Ctrl
请注意,这需要 Python 3 extension要安装。
关于python - 如何在 vscode 中运行几行选定的代码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59434361/