交互式命令行:
[[email protected] ~]# 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脚本:
[[email protected] ~]# vim a.py
#!/bin/env python
print("hello!word")
[[email protected] ~]# chmod +x a.py
[[email protected] ~]# ./a.py
hello!word
时间: 2024-10-23 07:08:50