Browse Source

Format

pull/10/head
Jure Šorn 5 years ago
parent
commit
db2990bf6a
1 changed files with 6 additions and 6 deletions
  1. 12
      README.md

12
README.md

@ -329,7 +329,7 @@ Format
```
### General Options
```bash
```python
{<el>:<10} # '<el> '
{<el>:>10} # ' <el>'
{<el>:^10} # ' <el> '
@ -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.

Loading…
Cancel
Save