您的位置:首页 > 编程语言 > Python开发

Python之第一个程序

2017-04-22 23:41 169 查看
交互式命令行:

print()
函数可以用于输出指定的字符串

[root@localhost ~]# python #进入交互式界面
Python 2.6.6 (r266:84292, Jul 23 2015, 14:41:34)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-11)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print("hello!word") #注意格式
hello!word
>>> exit() #退出

Python脚本:
[root@localhost ~]# vim a.py
#!/bin/env python
print("hello!word")

[root@localhost ~]# chmod +x a.py
[root@localhost ~]# ./a.py
hello!word
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  linux python