当前位置:网站首页>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'
边栏推荐
- Flutter3.0, the applet is not only run across mobile applications
- [MySQL] row sorting in MySQL
- cuda编程
- qt-线程等01概念
- Hisilicon 3559 universal platform construction: RTSP real-time playback support
- What is Ba? How about Ba? What is the relationship between Ba and Bi?
- 什么是 BA ?BA怎么样?BA和BI是什么关系?
- Enter the rough outline of the URL question (continuously updated)
- CMB's written test - quantitative relationship
- Open3D 网格滤波
猜你喜欢
Kotlin Android 环境搭建
Some thoughts on cross end development of kbone and applet
什么是 BA ?BA怎么样?BA和BI是什么关系?
[leetcode] 450 and 98 (deletion and verification of binary search tree)
Set static IP for raspberry pie
QT 打开文件 使用 QFileDialog 获取文件名称、内容等
Huawei and Xiaomi "copy each other"
Kbone与小程序跨端开发的一些思考
codeforces每日5题(均1700)-第七天
Restcloud ETL Community Edition June featured Q & A
随机推荐
【安全攻防】序列化與反序列,你了解多少?
PHP lightweight Movie Video Search Player source code
The true face of function pointer in single chip microcomputer and the operation of callback function
Open3d mesh filtering
Open3D 网格滤波
Implementation of map and set
opencv第三方库
codeforces每日5题(均1700)-第七天
海思万能平台搭建:颜色空间转换YUV2RGB
Enumeration general interface & enumeration usage specification
About Confidence Intervals
Create commonly used shortcut icons at the top of the ad interface (menu bar)
Huawei and Xiaomi "copy each other"
使用 BR 恢复 GCS 上的备份数据
Delete data in SQL
First understand the principle of network
Codeworks 5 questions per day (1700 average) - day 7
C task expansion method
海思3559万能平台搭建:RTSP实时播放的支持
About Tolerance Intervals