python-算数运算符对应的函数

 

__add__(self, other):       用于 + 操作符
__sub__(self, other):       用于 - 操作符
__mul__(self, other):      用于 * 操作符
__truediv__(self, other): 用于 / 操作符
__floordiv__(self, other):用于 // 操作符
__mod__(self, other):    用于 % 操作符
__pow__(self, other):     用于 ** 操作符

 

 

 

 

 

 

 

posted @ 2024-09-18 14:41  天子骄龙  阅读(29)  评论(0)    收藏  举报