Hexadecimal integer , Use 0-9、a-f To represent an integer , Must be 0x start
x= 0xfa
print(x)
D:\python\python.exe D:/pycharm/python project /subject1.py
250
Process finished with exit code 0
Octal integer , Use 0-7 Represents an integer , Must be 0o start
x= 0o35
print(x)
D:\python\python.exe D:/pycharm/python project /subject1.py
29
Process finished with exit code 0
Binary integer , Use 0、1 To represent an integer , Must be 0b start
x= 0b100
print(x)
D:\python\python.exe D:/pycharm/python project /subject1.py
4
Process finished with exit code 0
x= 250
print(hex(x))
D:\python\python.exe D:/pycharm/python project /subject1.py
0xfa
Process finished with exit code 0
x= 4
print(bin(x))
D:\python\python.exe D:/pycharm/python project /subject1.py
0b100
Process finished with exit code 0
x= 29
print(oct(x))
D:\python\python.exe D:/pycharm/python project /subject1.py
0o35
Process finished with exit code 0