📜  在python代码示例中将负数转换为正数

📅  最后修改于: 2022-03-11 14:46:25.800000             🧑  作者: Mango

代码示例2
>>> n = -42
>>> -n       # if you know n is negative
42
>>> abs(n)   # for any n
42
>>> abs(-5.05)
5.05