Browse Source

Revert format

pull/30/head
Jure Šorn 6 years ago
parent
commit
d09a7d6517
1 changed files with 20 additions and 20 deletions
  1. 40
      README.md

40
README.md

@ -337,43 +337,43 @@ Format
### General Options
```python
f'{<el>:<10}' # '<el> '
f'{<el>:>10}' # ' <el>'
f'{<el>:^10}' # ' <el> '
f'{<el>:->10}' # '------<el>'
f'{<el>:>0}' # '<el>'
{<el>:<10} # '<el> '
{<el>:>10} # ' <el>'
{<el>:^10} # ' <el> '
{<el>:->10} # '------<el>'
{<el>:>0} # '<el>'
```
### 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'
```

Loading…
Cancel
Save