python未完结

发布时间:2019-08-15 09:58:13编辑:auto阅读(1697)

    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



关键字

上一篇: python 第2天

下一篇: python列表(Lists)