AdSense

網頁

2019/8/14

Python 在VS Code開發Python程式教學

本篇介紹如何在Visual Studio Code編輯器開發Python程式。

首先安裝Visual Studio Code

VS Code要執行Python程式,要安裝擴充套件[Python extension for Visual Studio Code]。

打開VS Code的擴充套件,按快速鍵Ctrl + Shift + X,然後搜尋"python",點擊[install]開始下載。



Python擴充套件裝好後,新增一個檔案。



在編輯區輸入以下內容。

print("hello world")

然後把檔案存檔為hello.py



然後在編輯區點選滑鼠右鍵打開功能選單,選擇[Run Python File in Terminal]來在VS Code的Terminal執行此份hello.py檔案



執行後在VS Code的Terminal顯示如下。

C:\Users\matt>C:/Users/matt/AppData/Local/Programs/Python/Python37/python.exe c:/users/matt/Desktop/hello.py
hello world

之後就可用VS Code來執行Python程式了。

接著請看Python 在VS Code debug Python程式

若文章對您有幫助還幫忙點個廣告鼓勵,謝謝您的支持。


參考:

沒有留言:

AdSense