当前位置:网站首页>Binary, octal, hexadecimal
Binary, octal, hexadecimal
2022-07-07 03:57:00 【Is it far? My Shangri La】
Number to string :bin()、oct()、hex()
>>> bin(15) # Binary system
'0b1111'
>>> oct(15) # octal
'0o17'
>>> hex(15) # Hexadecimal
'0xf'
String to number :int()
>>> int('0b1111',2) # Binary system
15
>>> int('0o17',8) # octal
15
>>> int('0xf',16) # Hexadecimal
15
Format display
>>> "{0:#x}".format(0xf) # Lowercase letters , Hexadecimal number
'0xf'
>>> "{0:#X}".format(0xf) # Capital
'0XF'
>>> "{0:#x}".format(15) # Lowercase letters , Decimal number
'0xf'
>>> "{0:x}".format(15) # Lowercase letters , Decimal number , Without prefix 0x
'f'
>>> "{0:0>8x}".format(255) # Occupy 8 Bit character , Align left , repair 0
'000000ff'
边栏推荐
- Termux set up the computer to connect to the mobile phone. (knock the command quickly), mobile phone termux port 8022
- PHP lightweight Movie Video Search Player source code
- SQL injection -day15
- API data interface of A-share index component data
- Open3d mesh filtering
- MySQL的存储引擎
- 红米k40s root玩机笔记
- cuda编程
- 1.19.11.SQL客户端、启动SQL客户端、执行SQL查询、环境配置文件、重启策略、自定义函数(User-defined Functions)、构造函数参数
- Kbone与小程序跨端开发的一些思考
猜你喜欢
It's too convenient. You can complete the code release and approval by nailing it!
什么是 BA ?BA怎么样?BA和BI是什么关系?
My brave way to line -- elaborate on what happens when the browser enters the URL
卡尔曼滤波-1
Que savez - vous de la sérialisation et de l'anti - séquence?
About Tolerance Intervals
Tflite model transformation and quantification
Enumeration general interface & enumeration usage specification
[MySQL] row sorting in MySQL
接口数据安全保证的10种方式
随机推荐
API data interface of A-share index component data
A 股指数成分数据 API 数据接口
Ubuntu20 installation redisjson record
哈夫曼树基本概念
[safe office and productivity application] Shanghai daoning provides you with onlyoffice download, trial and tutorial
QT item table new column name setting requirement exercise (find the number and maximum value of the array disappear)
浅谈网络安全之文件上传
[MySQL] row sorting in MySQL
使用 TiDB Lightning 恢复 GCS 上的备份数据
Do you choose pandas or SQL for the top 1 of data analysis in your mind?
Tflite model transformation and quantification
Vernacular high concurrency (2)
Implementation of map and set
预处理——插值
卡尔曼滤波-1
QT opens a file and uses QFileDialog to obtain the file name, content, etc
史上最全学习率调整策略lr_scheduler
Baidu map JS development, open a blank, bmapgl is not defined, err_ FILE_ NOT_ FOUND
map和set的实现
1200.Minimum Absolute Difference