diff --git a/README.md b/README.md index 0942dc7..5e4083a 100644 --- a/README.md +++ b/README.md @@ -337,43 +337,43 @@ Format ### General Options ```python -{:<10} # ' ' -{:>10} # ' ' -{:^10} # ' ' -{:->10} # '------' -{:>0} # '' +f'{:<10}' # ' ' +f'{:>10}' # ' ' +f'{:^10}' # ' ' +f'{:->10}' # '------' +f'{:>0}' # '' ``` ### String Options **`'!r'` calls object's repr() method, instead of format(), to get a string.** ```python -{'abcde'!r:<10} # "'abcde' " -{'abcde':.3} # 'abc' -{'abcde':10.3} # 'abc ' +f'{'abcde'!r:<10}' # "'abcde' " +f'{'abcde':.3}' # 'abc' +f'{'abcde':10.3}' # 'abc ' ``` ### Number Options ```python -{ 123456:10,} # ' 123,456' -{ 123456:10_} # ' 123_456' -{ 123456:+10} # ' +123456' -{-123456:=10} # '- 123456' -{ 123456: } # ' 123456' -{-123456: } # '-123456' +f'{ 123456:10,}' # ' 123,456' +f'{ 123456:10_}' # ' 123_456' +f'{ 123456:+10}' # ' +123456' +f'{-123456:=10}' # '- 123456' +f'{ 123456: }' # ' 123456' +f'{-123456: }' # '-123456' ``` #### Float types: ```python -{1.23456:10.3f} # ' 1.235' -{1.23456:10.3e} # ' 1.235e+00' -{1.23456:10.3%} # ' 123.456%' +f'{1.23456:10.3f}' # ' 1.235' +f'{1.23456:10.3e}' # ' 1.235e+00' +f'{1.23456:10.3%}' # ' 123.456%' ``` #### Int types: ```python -{90:10c} # ' Z' -{90:10X} # ' 5A' -{90:010b} # '0001011010' +f'{90:10c}' # ' Z' +f'{90:10X}' # ' 5A' +f'{90:010b}' # '0001011010' ```