From d09a7d651762d341e39f2373a160e8de15284517 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Thu, 28 Mar 2019 23:07:22 +0100 Subject: [PATCH] Revert format --- README.md | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index aab0640..55f9239 100644 --- a/README.md +++ b/README.md @@ -337,43 +337,43 @@ Format ### General Options ```python -f'{:<10}' # ' ' -f'{:>10}' # ' ' -f'{:^10}' # ' ' -f'{:->10}' # '------' -f'{:>0}' # '' +{:<10} # ' ' +{:>10} # ' ' +{:^10} # ' ' +{:->10} # '------' +{:>0} # '' ``` ### String Options **`'!r'` calls object's repr() method, instead of format(), to get a string.** ```python -f'{"abcde"!r:<10}' # "'abcde' " -f'{"abcde":.3}' # 'abc' -f'{"abcde":10.3}' # 'abc ' +{'abcde'!r:<10} # "'abcde' " +{'abcde':.3} # 'abc' +{'abcde':10.3} # 'abc ' ``` ### Number Options ```python -f'{ 123456:10,}' # ' 123,456' -f'{ 123456:10_}' # ' 123_456' -f'{ 123456:+10}' # ' +123456' -f'{-123456:=10}' # '- 123456' -f'{ 123456: }' # ' 123456' -f'{-123456: }' # '-123456' +{ 123456:10,} # ' 123,456' +{ 123456:10_} # ' 123_456' +{ 123456:+10} # ' +123456' +{-123456:=10} # '- 123456' +{ 123456: } # ' 123456' +{-123456: } # '-123456' ``` #### Float types: ```python -f'{1.23456:10.3f}' # ' 1.235' -f'{1.23456:10.3e}' # ' 1.235e+00' -f'{1.23456:10.3%}' # ' 123.456%' +{1.23456:10.3f} # ' 1.235' +{1.23456:10.3e} # ' 1.235e+00' +{1.23456:10.3%} # ' 123.456%' ``` #### Int types: ```python -f'{90:10c}' # ' Z' -f'{90:10X}' # ' 5A' -f'{90:010b}' # '0001011010' +{90:c} # 'Z' +{90:X} # '5A' +{90:08b} # '01011010' ```