2019-06-24
阅读量:
422
Python中整数的最大可能值是多少?
在Python中,整数的值不受位数的限制,可以扩展到可用内存的限制。因此,我们永远不需要任何特殊的安排来存储大数字(想象一下在C / C ++中进行上述算术)。
作为旁注,在Python 3中,对于所有类型的整数,只有一种类型“int”。在Python 2.7中。有两个单独的类型“int”(32位)和“long int”与Python 3.x的“int”相同,即可以存储任意大的数字。
# A Python program to show that there are two types in
# Python 2.7 : int and long int
# And in Python 3 there is only one type : int
x = 10
print(type(x))
x = 10000000000000000000000000000000000000000000
print(type(x))






评论(0)


暂无数据
推荐帖子
0条评论
0条评论
0条评论