Archive for the ‘Python’ Category
webpy

web.py 官网: http://www.webpy.org 最近对 python 的一个web框架 web.py 发生了浓厚的兴趣,虽然 web.py 自带webserver,但是我还是想把它和 apache 结合起来,所以研究了一下 web.py 在 apache 环境下的环境架设。 仔细研究了一下 web.py 的官方网站install文档,原来 web.py…

October 21st, 2010

python3.0与2.x之间的区别

1 Comment, Python, by hyperblue.
pytestgraph

1.性能 Py3.0运行pystone benchmark的速度比Py2.5慢30%。Guido认为Py3.0有极大的优化空间,在字符串和整形操作上可以取得很好的优化结果。 2.编码 Py3.0源码文件默认使用utf-8编码,这就使得以下代码是合法的: >>>中国 = ‘china’ >>> print(中国) china 3.语法 1)去除了,全部改用!= 2)去除“,全部改用repr() 3)关键词加入as和with,还有True,False,None 4)整型除法返回浮点数,要得到整型结果,请使用// 5)加入nonlocal语句。使用noclocal x可以直接指派外围(非全局)变量 6)去除print语句,加入print()函数实现相同的功能。同样的还有exec语句,已经改为exec()函数 1…

October 21st, 2010

我的Python入门练习

1 Comment, Python, by hyperblue.
python_helloworld

平台:windowXP + Python3.1 python3.0与2.x之间的区别: http://www.kushu.net/538.html Hello World练习:熟悉基本的变量,列表,映射,输出。 (python3.x与2.x的区别之一:print * => print (*) 必须要有双括号)。 hello_world.py View Code PYTHON1 2 3 4 5 6…