凡科门店通包括哪些产品,seo厂商,wordpress定义数组,福田网站建设团队1. math相关函数 函 数描 述ceil(x) 大于或等于x的整数cos(x) x的余弦 degrees(x)将x的弧度转换为度数exp(x)e的x次方factorial(n)计算n的阶乘(n!),n 必须为整数log(x)以e为底的x的对数log(x,b)以b为底的x的对数pow(x,y)x的y次方radians(s)将x转换为弧度数sin(x)x的正弦…1. math相关函数 函 数描 述ceil(x) 大于或等于x的整数cos(x) x的余弦 degrees(x)将x的弧度转换为度数exp(x)e的x次方factorial(n)计算n的阶乘(n!),n 必须为整数log(x)以e为底的x的对数log(x,b)以b为底的x的对数pow(x,y)x的y次方radians(s)将x转换为弧度数sin(x)x的正弦sqrt(x)x的平方根tan(x)x的正切 math.ceil(1.1)
2math.cos(1)
0.5403023058681398math.degrees(1)
57.29577951308232math.exp(1)
2.718281828459045math.factorial(5)
120math.log(1)
0.0math.log(2,4)
0.5math.pow(2,3)
8.0math.sin(90)
0.8939966636005579math.sqrt(3)
1.7320508075688772math.tan(90)
-1.995200412208242 2. 字符串拼接相关方法 * hot dog
hotdog10 * haha
hahahahahahahahahahahahahahahahahahahaha3 * hee 2 * !
heeheehee!! 3. 列出模块中的函数 dir(module) import mathdir(math)
[__doc__, __loader__, __name__, __package__, __spec__, acos, acosh, asin, asinh, atan, atan2, atanh, ceil, copysign, cos, cosh, degrees, e, erf, erfc, exp, expm1, fabs, factorial, floor, fmod, frexp, fsum, gamma, gcd, hypot, inf, isclose, isfinite, isinf, isnan, ldexp, lgamma, log, log10, log1p, log2, modf, nan, pi, pow, radians, sin, sinh, sqrt, tan, tanh, trunc] 4. 查看函数的帮助字符串 help(func) help(math.floor)
Help on built-in function floor in module math:floor(...)floor(x)Return the floor of x as an Integral.This is the largest integer x. 5. 查看文档字符串 func.__doc__ print(math.floor.__doc__)
floor(x)Return the floor of x as an Integral.
This is the largest integer x. 6. 将整数和字符串转换为浮点数 float(x), x 为str 或 int类型 float(3)
3.0float(3)
3.0 7. 浮点数转换为整数int(x)舍去小数round(x)为银行家圆整--最接近的偶数 int(8.5)
8round(8.5)
8int(9.5)
9round(9.5)
10 8. 变量的多行赋值 x, y, z 1, two, 3.0x, y, z
(1, two, 3.0) 转载于:https://www.cnblogs.com/yunmenzhe/p/7506071.html