# `Otera.Format`
[🔗](https://github.com/georgeguimaraes/otera/blob/v0.1.0/lib/otera/format.ex#L1)

Python string formatting: the `%` operator, which the `format` filter of Jinja2 uses, and `str.format()`.

Both support the conversions and the format specification that templates use: fill, alignment, sign, width, precision, and the types `s`, `r`, `d`, `i`, `f`, `e`, `g`, `x`, `o`, `b`, `c` and `%`.

# `fixed`

```elixir
@spec fixed(float(), integer()) :: String.t()
```

Formats a non-negative float with `decimals` digits after the point, like Python `"%.<decimals>f"`. A negative `decimals` rounds to tens, hundreds and so on.

The digits come from the exact value of the float, rounded half to even, as in Python.

# `format`

```elixir
@spec format(String.t(), list(), Otera.Dict.t()) :: String.t()
```

Formats `args` and `kwargs` into `format` with the rules of Python `str.format()`.

# `printf`

```elixir
@spec printf(String.t(), term()) :: String.t()
```

Formats `args` into `format` with the rules of the Python `%` operator.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
