python的安装和版本选型
1.安装官网的下载目录是 http://www.python.org/ftp/python/
按需下载
centos5的python是2.4.3,同时有python26的包可用,版本是2.6.5 epel的库里的
fedora的python是2.7,同时有python3的包可以用,版本是3.1.2
2.使用
建议用py3k的语法写,但是用python2.5/2.6/2.7运行(考虑到里面的库)
详细可以借鉴http://docs.python.org/py3k/library/__future__.html
from __future__ import print_function
然后就可以按照3k的语法来写了,但是可以在2.x上运行
featureoptional inmandatory ineffectnested_scopes2.1.0b12.2PEP 227:Statically Nested Scopesgenerators2.2.0a12.3PEP 255:Simple Generatorsdivision2.2.0a23.0PEP 238:Changing the Division Operatorabsolute_import2.5.0a12.7PEP 328:Imports: Multi-Line and Absolute/Relativewith_statement2.5.0a12.6PEP 343:The “with” Statementprint_function2.6.0a23.0PEP 3105:Make print a functionunicode_literals2.6.0a23.0PEP 3112:Bytes literals in Python 3000
页:
[1]