Python 的編碼工具不少。目前最流行的是 pycharm,關於 pycharm 的安裝使用請參考 PyCharm安裝使用教程。python
而學習過程當中,我以爲最好用的,仍是 Python 自帶的練習工具 IDLE
。這款工具不用安裝,裝好 Python 後就有了。shell
這款工具最大的好處,就是變量的值、函數返回值均可以直接展現,不用打印便可查看。這極大了方便學習過程當中,須要不斷的查看各類語句的執行結果。ubuntu
打開工具,Windows 開始菜單 > 全部程序 > Python 3.6 > IDLE (Python 3.6 32-bit)
打開後,界面以下:windows
在練習過程當中,若是須要建立 Python 文件,也能夠經過 IDLE 操做:
打開File > New File
或者使用快捷鍵Ctrl + N
在新建的窗口中輸入 Python 代碼
而後能夠運行,運行方式能夠直接按 F5
或者點擊菜單欄中的Run > Run Module
運行後會彈出要求保存的提示
點擊肯定後,保存到你存放練習筆記的目錄便可。
運行後,會回到 Python IDLE 的 shell 界面,上面顯示了你當前運行的文件名稱。你能夠接下來在光標位置繼續操做。ide
固然我如今用的主題修改過,修改主題的方法以下:
打開菜單 Options > Config IDLE
函數
config-highlight.cfg
文件,直接使用 windows鍵 + R
打開「運行」,在運行窗口輸入(拷貝粘貼進去便可): notepad %USERPROFILE%\.idlerc\config-highlight.cfg
這句命令會用記事本打開 config-highlight.cfg
文件。
若是沒有這個文件,則使用以下命令:工具
%USERPROFILE%\.idlerc\
該命令會進入一個文件夾,在該文件夾下新建一個文本文件,把名字修改成 config-highlight.cfg
,右鍵使用記事本打開。學習
而後將下面的這段內容所有拷貝粘貼進去字體
[Obsidian] definition-foreground = #678CB1 error-foreground = #FF0000 string-background = #293134 keyword-foreground = #93C763 normal-foreground = #E0E2E4 comment-background = #293134 hit-foreground = #E0E2E4 builtin-background = #293134 stdout-foreground = #678CB1 cursor-foreground = #E0E2E4 break-background = #293134 comment-foreground = #66747B hilite-background = #2F393C hilite-foreground = #E0E2E4 definition-background = #293134 stderr-background = #293134 hit-background = #000000 console-foreground = #E0E2E4 normal-background = #293134 builtin-foreground = #dd17e8 stdout-background = #293134 console-background = #293134 stderr-foreground = #FB0000 keyword-background = #293134 string-foreground = #EC7600 break-foreground = #E0E2E4 error-background = #293134 [tango] definition-foreground = #fce94f error-foreground = #fa8072 string-background = #2e3436 keyword-foreground = #8cc4ff normal-foreground = #ffffff comment-background = #2e3436 hit-foreground = #ffffff break-foreground = #000000 builtin-background = #2e3436 stdout-foreground = #eeeeec cursor-foreground = #fce94f hit-background = #2e3436 comment-foreground = #73d216 hilite-background = #edd400 definition-background = #2e3436 stderr-background = #2e3436 break-background = #2e3436 console-foreground = #87ceeb normal-background = #2e3436 builtin-foreground = #ad7fa8 stdout-background = #2e3436 console-background = #2e3436 stderr-foreground = #ff3e40 keyword-background = #2e3436 string-foreground = #e9b96e hilite-foreground = #2e3436 error-background = #2e3436
以下圖:
拷貝進去後,保存並關閉。ui
關閉 IDLE 從新打開,進入剛纔的設置界面,點擊 Highlights
,選擇剛纔配置的主題 Obsidian
或 tango
。
而後愉快的編碼吧,好看的字體和配色也會讓本身學習的興趣增長很多!
其他的編碼工具包括 Sublime text、Eclipse 等,請參考其餘網上教程。