The integer data type (int)

Python is an integer represented by int.
python2 in:

  • On 32-bit machines, the integer number of bits is 32 bits, the range -2 ^ 31 to 2 ^ 31-1, i.e. -2147483648 2147483647
  • In the 64-bit system, 64 bits integer is the range -2 ^ 63 to 2 ^ 63-1, i.e. -9223372036854775808 ~ 9223372036854775807
  • After exceeding the length will become long.
    python3 in:
  • Int is not only long, all figures are int.

Note: When using the division in python2, you can only retain the integer bit, if you want to keep decimal places, you can import a module.

    1. from __future__ import division
    2. value = 3/2
    3. print(value) 

       

       

Guess you like

Origin www.cnblogs.com/sundy08/p/11785530.html