Max Int in Python

To find the maximum integer for your version of Python before it is switched to a long int data type, import the sys module and call the maxint function.

 

For Python 2

If you are using Python 2.* call sys.maxint like this:

 

import sys

print(sys.maxint)
9223372036854775807

 

For Python 3

In Python 3 the sys.maxint function was removed, so you will need to use sys.maxsize instead.

 

import sys

print(sys.maxsize)
9223372036854775807