2进制 8进制 10进制 16进制
2进制 - bin(int(x, 8)) bin(int(x, 10)) bin(int(x, 16))
8进制 oct(int(x, 2)) - oct(int(x, 10)) oct(int(x, 16))
10进制 int(x, 2) int(x, 8) - int(x, 16)
16进制 hex(int(x, 2)) hex(int(x, 8)) hex(int(x, 10)) -

格式化输出

>>> x = 1234
>>> bin(x)
'0b10011010010'
>>> oct(x)
'0o2322'
>>> hex(x)
'0x4d2' //如果你不想输出0b , 0o 或者0x 的前缀的话,可以使用format() 函数 >>> format(x, 'b')
'10011010010'
>>> format(x, 'o')
'2322'
>>> format(x, 'x')
'4d2'

  

最新文章

  1. xinetd cpu 100%
  2. eclipse建立springMVC 简单项目
  3. 当shiro做成动态URL管理时出现循环注入BeanCurrentlyInCreationException的问题解决方法
  4. TeXmacs 中输入狄拉克 braket 符号
  5. Docker tips
  6. SVN库迁移过程总结
  7. c# 高效分页只需一个dll实例
  8. JQuery(三)——操作HTML和CSS内容
  9. 百度APP移动端网络深度优化实践分享(一):DNS优化篇
  10. Python第八天 模块 包 全局变量和内置变量__name__ Python path
  11. Android学习之基础知识九 — 数据存储(持久化技术)之SQLite数据库存储
  12. uoj233/BZOJ4654/洛谷P1721 [Noi2016]国王饮水记 【dp + 斜率优化】
  13. confusing c++ 重写 与 重定义 记录1
  14. Swift3 获取当前连接WIFI名称
  15. Windows下搭建appium(Android版)
  16. 解决:在pom.xml处理添加testng依赖之外,需对testng进行关联
  17. python【数据类型:集合】
  18. K-Means & Sequential Leader Clustering
  19. Alpha-9
  20. IIS 搭建过程

热门文章

  1. 交换分区swap
  2. FTP服务器搭建基础工具:Serv-U 14.0.2使用教程
  3. CDH6.2的spark访问oss
  4. postgres csv日志和查看用户权限
  5. 网络流+最小生成树的最少割边数--How Many to Be Happy?
  6. Go-函数高级使用-条件分支-包管理-for循环-switch语句-数组及切片-与或非逻辑符
  7. 怎样修改一个已存在的Cookie
  8. Jmeter4.0---- 修改jmeter源代码(18)
  9. MQTT图形化客户端比较
  10. Web API 自动生成接口文档