__divmod__(self, other):定义当被 divmod() 调用时的行为,返回的值是一个元组:(a//b,a%b)
如:
>>>divmod(7, 2)
(3, 1)
__mod__(self, other):定义取模算法的行为:%
如:
>>>7% 2
1
__floordiv__(self, other):地除法,定义整数除法的行为://,返回值去掉小数
如:
>>>7//2
3
__divmod__(self, other):定义当被 divmod() 调用时的行为,返回的值是一个元组:(a//b,a%b)
如:
>>>divmod(7, 2)
(3, 1)
__mod__(self, other):定义取模算法的行为:%
如:
>>>7% 2
1
__floordiv__(self, other):地除法,定义整数除法的行为://,返回值去掉小数
如:
>>>7//2
3