Message355767
When formatting an integer as a hexadecimal value, the '#' alternate form modifier inserts a preceding '0x'.
If this is used in combination with padding modifiers, the '0x' is counted as part of the overall width, which does not feel like the natural behaviour as extra calculation is required to get the correct post '0x' precision.
Example:
In [7]: f'{num:04x}'
Out[7]: '0800'
In [8]: f'{num:#04x}'
Out[8]: '0x800'
To get the hexadecimal representation padded to 4 digits, you have to account for the preceding 0x:
In [10]: f'{num:#06x}'
Out[10]: '0x0800' |
|
Date |
User |
Action |
Args |
2019-10-31 20:36:00 | Wicken | set | recipients:
+ Wicken |
2019-10-31 20:36:00 | Wicken | set | messageid: <1572554160.44.0.882070489525.issue38657@roundup.psfhosted.org> |
2019-10-31 20:36:00 | Wicken | link | issue38657 messages |
2019-10-31 20:36:00 | Wicken | create | |
|