Format Percentage

Format a decimal number as a percentage with configurable precision.

Code

Utilities
f"{num * 100:.{decimals}f}%"

Parameters

The decimal number (0-1).

Decimal places to show.

Server

More Python Snippets