On this page
  1. float
  2. Import & Availability
  3. Overview & Signature
  4. Common Methods & Attributes
  5. Usage
  6. Gotchas
  7. REPL Inspect

float

Prev: filter | Up: __builtins__ | Next: format
Rel: bool, int, complex, str, bytes
Ref: docs.python.org — float
Tags: #public #python3 #builtins


Import & Availability

# Built-in (available globally without import)
from builtins import float

Overview & Signature

float(x=0, /)

Convert a string or number to a floating-point number, if possible.

Common Methods & Attributes

Usage

assert float("3.14") == 3.14
assert float("inf") > 1e308
assert float("nan") != float("nan")

Gotchas

REPL Inspect

help(float)

Linked from

Related notes