1 a = 1886 2 # 取商和余数 3 print(a.__divmod__(10)) 4 5 # r=反转,想当于 10-1886 6 print(a.__rsub__(10)) 7 8 # 取绝对值 9 print(a.__abs__(), abs(a)) 10 11 #商取整 12 print(a.__floordiv__(10), a // 10)
1 a = 1886 2 # 取商和余数 3 print(a.__divmod__(10)) 4 5 # r=反转,想当于 10-1886 6 print(a.__rsub__(10)) 7 8 # 取绝对值 9 print(a.__abs__(), abs(a)) 10 11 #商取整 12 print(a.__floordiv__(10), a // 10)