10 decimal, hexadecimal, octal and binary conversion:
(#: reserved hexadecimal prefix)
For those with hexadecimal prefix, such as “0x” “0o” “0b”, you can directly add ‘x’ and ‘o’ ‘B’ to delete them:
format(num, ",") Fast division of millennia
How many digits are the numbers to complete, ^ center > right alignment < left alignment
*^10 ⟹ there are 10 digits in total, in the middle, and the rest are filled with *
Supplement: Python binary conversion function and prefix interception
“Life is short, I use Python”. Powerful Python must also have its own built-in binary conversion function.
Decimal to other decimal:
Decimal number s:
A = bin (s) / / decimal to binary
B = OCT (s) / / decimal to octal
C = hex (s) / / decimal to hexadecimal
Convert other decimal to decimal:
s: Converted String
r: Number of hexadecimal digits to convert 2,6,18
10 after hexadecimal, octal and binary conversion, prefixes will appear, corresponding to “0x”, “0o” and “0b” respectively, as shown in the figure:
If you want to get the following specific values, you can finally intercept the string, str
str = ‘0123456789'
The above is my personal experience. I hope I can give you a reference, and I hope you can support developepper. If you have any mistakes or don’t consider completely, please don’t hesitate to comment.