From db2990bf6a22f6a414e1f7f19a9195d8f614853d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Tue, 29 Jan 2019 16:30:02 +0100 Subject: [PATCH] Format --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index e27adc7..28a3836 100644 --- a/README.md +++ b/README.md @@ -329,7 +329,7 @@ Format ``` ### General Options -```bash +```python {:<10} # ' ' {:>10} # ' ' {:^10} # ' ' @@ -339,22 +339,22 @@ Format ### String Options **`'!r'` calls object's repr() method, instead of format(), to get a string.** -```bash +```python {'abcde'!r:<10} # "'abcde' " ``` -```bash +```python {'abcde':.3} # 'abc' {'abcde':10.3} # 'abc ' ``` ### Number Options -```bash +```python {1.23456:.3f} # '1.235' {1.23456:10.3f} # ' 1.235' ``` -```bash +```python { 123456:10,} # ' 123,456' { 123456:10_} # ' 123_456' { 123456:+10} # ' +123456' @@ -363,7 +363,7 @@ Format {-123456: } # '-123456' ``` -```bash +```python {65:c} # 'A' {3:08b} # '00000011' -> Binary with leading zeros. {3:0<8b} # '11000000' -> Binary with trailing zeros.