Maximum and Minimum values for ints

前端 未结 9 1900
北荒
北荒 2020-11-22 06:36

I am looking for minimum and maximum values for integers in python. For eg., in Java, we have Integer.MIN_VALUE and Integer.MAX_VALUE. Is there som

9条回答
  •  心在旅途
    2020-11-22 06:56

    If you just need a number that's bigger than all others, you can use

    float('inf')
    

    in similar fashion, a number smaller than all others:

    float('-inf')
    

    This works in both python 2 and 3.

提交回复
热议问题