Python:1-2、编写第一个python程序
2017-10-18 本文已影响4人
CnPeng
有两种编写方式,一种是直接在终端中编写,一种是在编辑器中编写,具体如下:
一、在终端中编写
打开“超级终端”
![](https://img.haomeiwen.com/i2551993/844f9f5bfd1fa961.png)
输入python3 ,输入python3表示用的python这门编程语言的第3个版本,如果只输入python的话表示用的是python的第2个版本
![](https://img.haomeiwen.com/i2551993/53aa1f97edc5179c.png)
输入以下代码
print('hello world')
![](https://img.haomeiwen.com/i2551993/e7a902f8746c9085.png)
二、在编辑器中编写
打开编辑软件sublime
![](https://img.haomeiwen.com/i2551993/979ba86edf74198b.png)
把以下代码,编写如下代码
![](https://img.haomeiwen.com/i2551993/7c15652e6debed09.png)
保存代码
![](https://img.haomeiwen.com/i2551993/0050cbc439cdb630.png)
运行程序
![](https://img.haomeiwen.com/i2551993/f1ed71011332e883.png)
![](https://img.haomeiwen.com/i2551993/5af3e6fdf322f968.png)