python未完结
python
[root@localhost ~]# Python --version 查看python版本
Python 2.7.5
[root@localhost ~]# python
Python 2.7.5 (default, Feb 11 2014, 07:46:25)
[GCC 4.8.2 20140120 (Red Hat 4.8.2-13)] on linux2
Type "help", "copyright", "credits" or "license" for more infORMation.
>>> print "six six six"
six six six
>>> python使用print打印
[root@localhost ~]# vim pp.py
#!/usr/bin/env python 使用env的原因:与3.0达到同步
print "learn python well"
[root@localhost ~]# chmod +x pp.py 加上可执行权限
[root@localhost ~]# python pp.py 执行
learn python well
[root@localhost ~]# vim pp.py
#!/usr/bin/env python
print "中国人"
[root@localhost ~]# python pp.py
File "pp.py", line 2
SyntaxError: Non-ASCII character '\xe4' in file pp.py on line 2, but no encoding declared; see Http://www.python.org/peps/pep-0263.html for details
[root@localhost ~]# vim pp.py
[root@localhost ~]# python pp.py
中国人
#!/usr/bin/env python
#coding:utf-8 编码格式
print "中国人"
Python解释器
cpython,ipython
yum install python -y 安装python
相关文章