Staging: this is not the live site, pydocs.org.
Convert a string or number to a floating-point number, if possible.
Changed in 3.6, 3.7, 3.8
- 3.6: Grouping digits with underscores as in code literals is allowed.
- 3.7: The parameter is now positional-only.
- 3.8: Falls back to __index__() if __float__() is not defined.
Members of float
a
- as_integer_ratio
- Return a pair of integers, whose ratio is exactly equal to the original float.
f
- from_number
- Convert real number to a floating-point number.
- fromhex
- Create a floating-point number from a hexadecimal string.
h
- hex
- Return a hexadecimal representation of a floating-point number.