Browse Source

Format

pull/28/head
Jure Šorn 6 years ago
parent
commit
0df2a3df6e
1 changed files with 7 additions and 15 deletions
  1. 22
      README.md

22
README.md

@ -347,12 +347,15 @@ Format
{'abcde':10.3} # 'abc ' {'abcde':10.3} # 'abc '
``` ```
### Number Options
### Float Options
```python ```python
{1.23456:.3f} # '1.235' {1.23456:.3f} # '1.235'
{1.23456:10.3f} # ' 1.235' {1.23456:10.3f} # ' 1.235'
{1.23456:10.3e} # ' 1.235e+00'
{1.23456:10.3%} # ' 123.456%'
``` ```
### Int Options
```python ```python
{ 123456:10,} # ' 123,456' { 123456:10,} # ' 123,456'
{ 123456:10_} # ' 123_456' { 123456:10_} # ' 123_456'
@ -363,22 +366,11 @@ Format
``` ```
```python ```python
{65:c} # 'A'
{3:08b} # '00000011' -> Binary with leading zeros.
{3:0<8b} # '11000000' -> Binary with trailing zeros.
{90:c} # 'Z'
{90:X} # '5A'
{3:08b} # '00000011'
``` ```
#### Float presentation types:
* **`'f'` - Fixed point: `.<precision>f`**
* **`'%'` - Percent: `.<precision>%`**
* **`'e'` - Exponent**
#### Integer presentation types:
* **`'c'` - character**
* **`'b'` - binary**
* **`'x'` - hex**
* **`'X'` - HEX**
Numbers Numbers
------- -------

Loading…
Cancel
Save