Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

VSCode Opening a Directory

VSCode Opening a Directory

We can open a code file in VS Code, and opening a directory (folder) in VS Code is also a simple process; the operations are all very simple.

First, we open the already installed VS Code. When VS Code is opened for the first time, you will see a welcome page with different operations to get started.

You can choose the New File... or Open... option:


Create a Python code file

Open VScode and click New File:

Click to select the language:

Type Python in the search box and select the Python option:

Enter the code:

print("Runoob")

Right-click and choose Run File in Interactive Window;if prompted to install extensions, just click Install (without it, it keeps showing "Connecting to Python kernel"):

Alternatively, we can open an existing file or directory (folder); for example, open a runoob-test folder, or create one yourself:

Then we create a test.py file: click the new file icon below and enter the file name test.py:

**Note:** runoob-test contains a .vscode folder with some configuration information; you can ignore it for now.

Enter the following code in test.py:

print("Runoob")

Click the green icon in the top-right corner to run:

You can also right-click the file and choose "Run Python File in Terminal":

Of course you can also right-click in the code window and choose "Run Python File in Terminal".