首页 > 解决方案 > python中的除法

问题描述

浏览python doc并执行以下操作:

ravi@user-ThinkCentre-M90:~$ python
Python 2.7.6 (default, Oct 26 2016, 20:30:19) 
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 17/3
5
>>>

为什么输出不是浮点数?

标签: pythonpython-2.7

解决方案


尝试这样划分:

17/3.0

推荐阅读