本文整理匯總了Python中builtins.abs方法的典型用法代碼示例。如果您正苦於以下問題:Python builtins.abs方法的具體用法?Python builtins.abs怎麽用?Python builtins.abs使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類builtins
的用法示例。
在下文中一共展示了builtins.abs方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: absolute
# 需要導入模塊: import builtins [as 別名]
# 或者: from builtins import abs [as 別名]
def absolute(x, **_):
return builtins.abs(x)
示例2: abs
# 需要導入模塊: import builtins [as 別名]
# 或者: from builtins import abs [as 別名]
def abs(a):
"Same as abs(a)."
return _abs(a)
示例3: abs
# 需要導入模塊: import builtins [as 別名]
# 或者: from builtins import abs [as 別名]
def abs(x):
'''Replacement for the built-in :func:`abs() <python:abs>` function.'''
return builtins.abs(x)
示例4: abs
# 需要導入模塊: import builtins [as 別名]
# 或者: from builtins import abs [as 別名]
def abs(x):
return builtins.abs(x)
示例5: polar
# 需要導入模塊: import builtins [as 別名]
# 或者: from builtins import abs [as 別名]
def polar(x):
return [abs(x), arg(x)]
示例6: conv_dec_gms
# 需要導入模塊: import builtins [as 別名]
# 或者: from builtins import abs [as 別名]
def conv_dec_gms(self, base_coord, coord_spacing, u, neg_character, pos_character):
xbase = base_coord + coord_spacing*u
x = abs(xbase)
xdeg = floor(round(x,4))
xmin = floor(round(((x - xdeg)*60),4))
xseg = floor(round(((x - xdeg - xmin/60)*60),4))
if xbase < 0:
xhem = neg_character
else:
xhem = pos_character
conv_exp_str = '\'' + str(xdeg).rjust(2,'0') + 'º ' + str(xmin).rjust(2,'0') + str('\\') + str('\' ') + str(xseg).rjust(2,'0') + '"\'' + '+\' ' + str(xhem) + '\''
return conv_exp_str