十六進制整數,使用0-9、a-f來錶示整數,必須以0x開頭
x= 0xfa
print(x)
D:\python\python.exe D:/pycharm/python項目/subject1.py
250
Process finished with exit code 0
八進制整數,使用0-7錶示整數,必須以0o開頭
x= 0o35
print(x)
D:\python\python.exe D:/pycharm/python項目/subject1.py
29
Process finished with exit code 0
二進制整數,使用0、1來錶示整數,必須以0b開頭
x= 0b100
print(x)
D:\python\python.exe D:/pycharm/python項目/subject1.py
4
Process finished with exit code 0
x= 250
print(hex(x))
D:\python\python.exe D:/pycharm/python項目/subject1.py
0xfa
Process finished with exit code 0
x= 4
print(bin(x))
D:\python\python.exe D:/pycharm/python項目/subject1.py
0b100
Process finished with exit code 0
x= 29
print(oct(x))
D:\python\python.exe D:/pycharm/python項目/subject1.py
0o35
Process finished with exit code 0