https://www.python.org/
下載并安裝最新版的 Python,我下載的是 3.7.2 for Windows。
1 啟動方法
Windows啟動 - All Programs - Python <version> - IDLE
2 主窗口
運行 Python IDLE 后,首先看到的是一個主窗口。這個主窗口是一個 Python 語言的解釋器,也就是你在這個解釋器中輸入一條 Python 語句,回車,Python 程序會立即執行這條語句。這樣的解釋器,也被稱為 Shell。
Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 22:20:52) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> print ("Hello world!")
Hello world!
>>>
>>> for i in range(3):
print(i)
0
1
2
>>>
3 編輯文件
在主窗口中,選擇菜單 File / New File,打開一個新的編輯窗口。編寫 Python 程序,然后選擇 Save。
for i in range(3):
print (i)
4 運行文件
保存文件后,在 Python 程序的編輯窗口中,可以直接運行。按下 F5,或選擇菜單 Run / Run Module,程序被運行。運行的結果可以在主窗口中看到。