In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
Learn how to run python code in vscode? This problem may be often seen in our daily study or work. I hope you can gain a lot from this article. Here is the reference content brought by the editor. Let's take a look at it!
The way for vscode to run python code is to first open vscode and install the plug-in Python;, and then in the Python workspace to run, modify the tasks.json; last shortcut [Ctrl+Shift+b] to run.
1. Install the Python plug-in
After entering the main interface, press Ctrl + p, type: ext install python, download the first one.
After downloading the Python plug-in, you can use the code completion feature when writing Python scripts.
two。 Set up Python to run
To run the Python code in Visual Studio Code, you need to modify the tasks.json configuration code, and to modify the tasks.json configuration code, you must first create a working folder.
To put it simply, different working folders should be oriented to different projects. You can then configure different languages to run by modifying the tasks.json file in the folder. Therefore, the tasks.json file will not appear until the working folder is created.
2.1 create a working folder
The main interface opens the explorer Ctrl + Shift + E, click Open folder, and select the folder (no folders are available to create a new folder under your desired directory).
2.2 modify the tasks.json configuration file
Find the tasks.json configuration file under the .vscode folder and drag it into Visual Studio Code to modify it.
You can also directly press Ctrl + Shift + p and enter: task, select Configure Task Runner.
Then select Others.
Open the file as follows:
Modify the configuration file:
1. The "echo" corresponding to command is changed to "python".
2. Modify the ["Helloworld"] corresponding to args to ["${file}"].
3. Save the changes (Ctrl + s).
2.3 run Python
Casually test the Python file in any working folder. Run using Ctrl + Shift + b.
Thank you for reading the above, do you have a general understanding of the article "how to run python code in vscode"? I hope the content of the article will be helpful to you. If you want to know more about the content of the article, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.