skip to Main Content

I have just recently get into Python programming. In the YouTube videos I’ve watched, every time they run a Python program, the VS Code terminal only show the output.

In my VS Code, it also shows two windows’ directories first before showing the output, which I’d rather not have. Below is my code on the computer screen:
PS C:UsersBillDesktopArtificial Intelligence> &

C:/Users/Bill/AppData/Local/Programs/Python/Python312/python.exe "c:/Users/Bill/Desktop/Artificial Intelligence/Day 1 - Self-taught Py/snake.py"
1

Is there any way I could make VS Code only show the output?

2

Answers


    1. Ensure python is installed
    2. To check that, open VS code, go to extension by pressing ctlr+shift+X and search for python and ensure it is installed.

    python extension

    1. Open command palette by pressing ctrl+shift+p and type tasks.

    2. Select Tasks: configure tasks, then choose Create tasks.json file from template then choose other as the template.

    3. Modify the tasks.json file with following content

      "version": "2.0.0",
      "tasks": [
          {
              "label": "Run Python File",
              "type": "shell",
              "command": "python",
              "args": [
                  "${file}"
              ],
              "group": {
                  "kind": "build",
                  "isDefault": true
              },
              "presentation": {
                  "reveal": "always",
                  "echo": false,
                  "focus": false,
                  "panel": "shared"
              },
              "problemMatcher": []
          }
      ]
      
      
    4. Run the Task: To run the Python file using this task, open the Command Palette (Ctrl+Shift+P) and type Run Task. Select Run Python File.

    Login or Signup to reply.
  1. The vsocde extension named: jupyter

    I often use this.

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search