Python hex() 函数

Python 3 教程 · 2019-02-05 11:27:42

描述

hex() 函数用于将10进制整数转换成16进制,以字符串形式表示。

语法

hex 语法:

hex(x)

参数说明:

  • x -- 10进制整数

返回值

返回16进制数,以字符串形式表示。

实例

以下实例展示了 hex 的使用方法:

>>>hex(255) '0xff' >>> hex(-42) '-0x2a' >>> hex(1L) '0x1L' >>> hex(12) '0xc' >>> type(hex(12)) <class 'str'> # 字符串

点击查看所有 Python 3 教程 文章: https://codercto.com/courses/l/10.html

查看所有标签

The Sovereign Individual

The Sovereign Individual

James Dale Davidson、William Rees-Mogg / Free Press / 1999-08-26 / USD 16.00

Two renowned investment advisors and authors of the bestseller The Great Reckoning bring to light both currents of disaster and the potential for prosperity and renewal in the face of radical changes ......一起来看看 《The Sovereign Individual》 这本书的介绍吧!

MD5 加密
MD5 加密

MD5 加密工具

html转js在线工具
html转js在线工具

html转js在线工具

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具