Skip to content

Commit

Permalink
Merge pull request #7 from treyhunner/improve-integer-examples
Browse files Browse the repository at this point in the history
Clarify integer examples
  • Loading branch information
The-Compiler committed May 6, 2022
2 parents a5b329f + 9f94484 commit 109fe9d
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions cheat.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@ These format specifications only work on all numbers (both `int` and `float`).

These examples assume the following variable:

>>> number = 9
>>> number = 10

| Example Output | Replacement Field | Alt | Fill | Width | Grouping | Type |
|----------------|-------------------|-----|------|-------|----------|------|
| `'09'` | `{number:02d}` | | `0` | `2` | | `d` |
| `' 9'` | `{number: 3d}` | | ` ` | `3` | | `d` |
| `'9'` | `{number:,}` | | | | `,` | |
| `'1001'` | `{number:b}` | | | | | `b` |
| `'9'` | `{number:x}` | | | | | `x` |
| `'9'` | `{number:X}` | | | | | `X` |
| `'0x9'` | `{number:#x}` | `#` | | | | `x` |
| `'0x9'` | `{number:#02x}` | `#` | `0` | `2` | | `x` |
| `'000_1001'` | `{number:08_b}` | | `0` | `8` | `_` | `b` |
| `'0010'` | `{number:04d}` | | `0` | `4` | | `d` |
| `' 10'` | `{number: 4d}` | | ` ` | `4` | | `d` |
| `'10'` | `{number:,}` | | | | `,` | |
| `'1010'` | `{number:b}` | | | | | `b` |
| `'a'` | `{number:x}` | | | | | `x` |
| `'A'` | `{number:X}` | | | | | `X` |
| `'0xa'` | `{number:#x}` | `#` | | | | `x` |
| `'000a'` | `{number:04x}` | | `0` | `4` | | `x` |
| `'0000_1010'` | `{number:09_b}` | | `0` | `9` | `_` | `b` |

An empty type is synonymous with `d` for integers.

Expand Down

0 comments on commit 109fe9d

Please sign in to comment.