  
- UID
- 2
- 积分
- 2914403
- 威望
- 1407234 布
- 龙e币
- 1507169 刀
- 在线时间
- 13521 小时
- 注册时间
- 2009-12-3
- 最后登录
- 2025-3-3

|
Python内置函数 - abs() 函数
描述
abs() 函数返回数字的绝对值。
语法
以下是 abs() 方法的语法:参数
x -- 数值表达式。
返回值
函数返回x(数字)的绝对值。
实例
以下展示了使用 abs() 方法的实例:- #!/usr/bin/python
- print "abs(-45) : ", abs(-45)
- print "abs(100.12) : ", abs(100.12)
- print "abs(119L) : ", abs(119L)
复制代码 以上实例运行后输出结果为:- abs(-45) : 45
- abs(100.12) : 100.12
- abs(119L) : 119
复制代码 |
论坛官方微信、群(期货热点、量化探讨、开户与绑定实盘)
|