python,同样是:1/4,2.7版返回0,3.2.3版就返回 0.25,不一致呀?
python,同样是:1/4,2.7版返回0,3.2.3版就返回 0.25,不一致呀?
Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32
>>> a=1/4
>>> a
0
Python 3.2.3 (default, Apr 11 2012, 07:15:24) [MSC v.1500 32 bit (Intel)] on win32
>>> a=1/4
>>> a
0.25
Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> 1 / 4.0
0.25
>>> 1 / float(4)
0.25
>>>