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 等,请参考其余网上教程。