发布时间:2019-09-16 07:15:49编辑:auto阅读(2144)
| Operation | Result | Notes |
|---|---|---|
| x + y | sum of x and y | |
| x - y | difference of x and y | |
| x * y | product of x and y | |
| x / y | quotient of x and y | (1) |
| x // y | (floored) quotient of x and y | (4)(5) |
| x % y | remainder of x / y | (4) |
| -x | x negated | |
| +x | x unchanged | |
| abs(x) | absolute value or magnitude of x | (3) |
| int(x) | x converted to integer | (2) |
| long(x) | x converted to long integer | (2) |
| float(x) | x converted to floating point | (6) |
| complex(re,im) | a complex number with real part re, imaginary part im. im defaults to zero. | |
| c.conjugate() | conjugate of the complex number c. (Identity on real numbers) | |
| divmod(x, y) | the pair (x // y, x % y) | (3)(4) |
| pow(x, y) | x to the power y | (3)(7) |
| x ** y | x to the power y | (7) |
| Operation | Result | Notes |
|---|---|---|
| math.trunc(x) | x truncated to Integral | |
| round(x[, n]) | x rounded to n digits, rounding ties away from zero. If n is omitted, it defaults to 0. | 四舍五入 |
| math.floor(x) | the greatest integral float <= x | |
| math.ceil(x) | the least integral float >= x |
| Operation | Meaning | Notes |
|---|---|---|
| < | strictly less than | |
| <= | less than or equal | |
| > | strictly greater than | |
| >= | greater than or equal | |
| == | equal | |
| != 或 <> | not equal | (1) |
| is | object identity | |
| is not | negated object identity |
| Operation | Result | Notes |
|---|---|---|
| x | y | bitwise or of x and y | |
| x ^ y | bitwise exclusive or of x andy | |
| x & y | bitwise and of x and y | |
| x << n | x shifted left by n bits | (1)(2) |
| x >> n | x shifted right by n bits | (1)(3) |
| ~x | the bits of x inverted |
上一篇: python中变量的声明和赋值
下一篇: CentOs7将Python版本从3.x
51155
50560
41179
38012
32476
29378
28242
23095
23059
21382
1433°
2135°
1775°
1696°
1995°
1769°
2450°
4124°
3992°
2850°