标签:浮点 python2 32位 int pytho long 取值 oat 类型
int(整形)
整数在python2整形、长整形。 32位取值范围-2**31~2**31-1。64位整形,取值范围为-2**63-3**63-1。
long(长整形)
python3 里面没有long
float(浮点数)
布尔值
1或0
真或假
a = 0 if a:print(‘a‘) a = 1 if a:print(‘a‘) a
complex(复数)
%取模
8%2
0
9%2
1
最简单的求解
取整除
10.3//3
3.9
10.3/3
3.4333333
运算符
== 等于
!=不等于
<>不等于
赋值运算
逻辑运算
and,or,not
a,b,c = 3,5,7 a >2 and c < 7 False
a > 2 and c < 8 and b > 4 True
a > 2 and c < 8 and b > 4 or c == 8 True a > 2 and c < 2 and b > 4 or c == 8 False
not
a = "333" if not a.isdigit():print("ddd") a = "aaa" if not a.isdigit():print("ddd") ddd
in
not in
\
is is not
标签:浮点 python2 32位 int pytho long 取值 oat 类型
原文地址:http://www.cnblogs.com/fsdl1988/p/7359915.html