Skip to content

Latest commit

 

History

History
17 lines (9 loc) · 425 Bytes

format-thousands.md

File metadata and controls

17 lines (9 loc) · 425 Bytes

Formatting thousands in Jinja

Here's how to format a number in Jinja with commas for thousands, without needing any custom filters or template functions:

{{ "{:,}".format(row_count) }}

Output looks like this:

179,119

Bonus: here's how to display a different pluralization of "row" if there is a single row:

{{ "{:,}".format(row_count) }} row{{ "" if row_count == 1 else "s" }}

Outputs:

179,119 rows