Python3 integer division [duplicate]

你说的曾经没有我的故事 提交于 2019-11-26 09:31:30

问题


This question already has an answer here:

  • Python integer division yields float 4 answers

In Python3 vs Python2.6, I\'ve noticed that I can divide two integers and get a float. How do you get the Python2.6 behaviour back? Is there a different method to get int/int = int?


回答1:


Try this:

a = 1
b = 2
int_div  = a // b


来源:https://stackoverflow.com/questions/19507808/python3-integer-division

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!