Python Number Methods
Numeric type methods — int, float, complex operations and conversions. This category documents 8 Python number methods entries, and each page gives you the full syntax, the parameter list, the return value, and a runnable example. The entries include: int.bit_length(), int.bit_count(), int.to_bytes(), int.from_bytes(), float.is_integer(), float.as_integer_ratio(), float.hex(), float.fromhex(). int.bit_length() returns the number of bits required to represent the integer in binary. int.bit_count() returns the number of ones in the binary representation of the integer. int.to_bytes() returns an array of bytes representing the integer. int.from_bytes() returns the integer represented by the given array of bytes. float.is_integer() returns True if the float is finite with integral value. Number Methods belongs to the Built-in Types group alongside String Methods, List Methods, Dictionary Methods, Set Methods. You can also search across every category from the search page, browse the complete A–Z index, or try any example in the Python playground.