1.次幂
>>>2**3
8
>>>pow(2,3) #不用导包
82.
变量类型判断
>>>x = raw_input()
>>>type(x)
<type 'str'>3.
四舍五入
round(n[,ndigits]) #按照要求精度四舍五入
>>>round(1.0/2.0)
1.04.
绝对值
>>>abs(-10)
10
5. math
.floor() #小于该数的最大值
6.
开根号
>>>math.sqrt(3)
>>>cmath.sqrt(-1)
7.上入取整数
math.ceil()8.
pow(x,y[,z])
x的y次方,结果对z取模
9.类型转换
str() #转为字符串
int (); long()#字符串和数字转换为
10.
repr() # 字符串表示形式
转载请注明原文地址: https://ju.6miu.com/read-500386.html