Pytho的数值类型包括:
name |
purpose |
int |
整型 |
long |
长整型(Python3中没有) |
float |
浮点数 |
complex |
复数 |
代码示例:
x
=
3
# 整数
f
=
3.141529
# 浮点数
name
=
"Python"
# 字符串
big
=
358315791L
# 长整型
z
=
complex
(
2
,
3
)
# (2+3i) 复数,包括实部和虚部
print
x
print
f
print
name
print
big
print
z
输出结果:
|
3
3.141529
Python
358315791
(
2
+
3j
)
|
数值的最大值
|
3
3.141529
Python
358315791
(
2
+
3j
)
|