| Format | Meaning | Example | Output |
|---|---|---|---|
:.2f | 2 decimal places | f"{3.14159:.2f}" | 3.14 |
:.0f | 0 decimal places | f"{3.7:.0f}" | 4 |
:.0% | percentage, 0 d.p. | f"{0.75:.0%}" | 75% |
:.1% | percentage, 1 d.p. | f"{0.75:.1%}" | 75.0% |
:02 | width 2, pad with 0 | f"{9:02}" | 09 |
:03 | width 3, pad with 0 | f"{9:03}" | 009 |
:, | thousands separator | f"{1000000:,}" | 1,000,000 |
:>10 | right-align width 10 | f"{'hi':>10}" | hi |
:<10 | left-align width 10 | f"{'hi':<10}" | hi |
:^10 | centre width 10 | f"{'hi':^10}" | hi |