在python中Template可以将字符串的格式固定下来,重复利用. Template属于string中的一个类,要使用他的话可以用以下方式调用: from string import Template 我们使用以下代码: >>> s = Template('There ${moneyType} is ${money}') >>> print s.substitute(moneyType = ) 运行结果显示“There Dollar is 12” 这样我们就可以
v2.2 (2.x)以后,python支持不会溢出的 long 型. v3.0后,确切的讲, int 型(依赖运行环境C编译器中long型的精度)消失了,long型替代 int 型,成为新的.不依赖运行环境的.无精度限制的(只要内存装得下)int型. 举个例子: ================== >>> a = 2147483647 # 32位机上,v3.0 以前 python 的 int 型能容纳的最大正整数,等同于 sys.maxint. >>> b = 1 &