python3 获取int最大值

python2 中获取int最大值

import sys
i = sys.maxint
print i

但是在python3中,报错:

AttributeError: module 'sys' has no attribute 'maxint'

看了官网文档后了解python3中没有maxint了,只有maxsize

import sys
i = sys.maxsize
print(i)

官网说明文档:https://docs.python.org/3.1/whatsnew/3.0.html#integers

出处:www.l1mn.com

原文标题:python3 获取int最大值

原文地址:https://www.l1mn.com/p/cld6o.html

本文版权归作者所有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接。

评论

皖ICP备2023023451号

Copyright © L1MN.COM 联系方式:l1mnfw@163.com