python - 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
>>>
为什么输出不是浮点数?
解决方案
尝试这样划分:
17/3.0
推荐阅读
- gradle - Gradle - 如何从子项目中获取任务输出
- python - 在没有上下文变量的模板中循环
- python - tell() 方法如何将输出显示为 11 而不是 10?
- function - 处理构造函数和函数错误
- machine-learning - 如何计算 HMM 的值?
- ruby-on-rails - CanCanCan 不允许访问返回所有记录的端点
- javascript - DOM更改背景图像,参数不起作用
- git - 使用 git config 列出部分中的所有配置条目
- sql-server - 加入用户自定义表类型参数查看
- windows - Perl :: 如何在 Windows 10 中使用西里尔文编码?