Operator Functions

operator.truediv()

Perform true division; integer inputs yield a float for ordinary built-in integers. Equivalent to a / b; custom operand types control the result.

Formal Syntax & Structure

python syntaxpython
operator.truediv(a, b, /)

Parameters & Attributes

NameTypeDescription
aobjectLeft operand or target object.
bobjectRight operand.

Return Value

object

The object result described above.

Working Example

Example Snippetpython
import operatorprint(operator.truediv(7, 2))
Python Reference