用Python编写hello world程序

1 用Python编写hello world程序

1.1 修改python连接,指向python2

这主要是为了解决 emacs 在python mode中经过C-c C-p 启动interpreter会进入python3的问题python

1.2 建立main.py文件

1.3 添加第一行指定是python2

1.4 编写两行代码

#!/usr/bin/python2

s = "hello, world"
print(s)

1.5 解释

  • 没有;结尾
  • 没有变量类型声明,哪怕是var, auto都没有
  • print函数是打印

1.6 运行

[dean@dell_xps_13 hello-world]$ chmod +x ./main.py
[dean@dell_xps_13 hello-world]$ ./main.py 
hello, world

Created: 2016-04-24 Sun 23:00bash

Validate函数