Python减法

示例

a, b = 1, 2

# Using the "-" operator:
b - a                  # = 1


import operator        # 包含2个自变量算术函数
operator.sub(b, a)     # = 1


可能的组合(内置类型):

  • int和int(给出int)

  • int和float(给a float)

  • int和complex(给a complex)

  • float和float(给a float)

  • float和complex(给a complex)

  • complex和complex(给a complex)