Python3 hex() 函数

 Python3 内置函数


描述

hex() 函数用于将一个指定数字转换为 16 进制数。

语法

hex 语法:

hex(x)

参数说明:

  • x -- 一个整数

返回值

返回一个字符串,以 0x 开头。

实例

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

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

 Python3 内置函数

Python3 hex() 函数的更多相关文章

  1. Python3 isinstance() 函数

    Python3 isinstance() 函数 描述 isinstance() 函数来判断一个对象是否是一个已知的类型,类似 type(). isinstance() 与 type() 区别: typ ...

  2. Python3 join函数和os.path.join用法

    Python3  join函数和os.path.join用法 os.path.join()连接两个文件名地址的时候,就比os.path.join("D:\","test. ...

  3. Python3 round() 函数

    Python3 round() 函数  Python3 数字 描述 round() 方法返回浮点数x的四舍五入值. 语法 以下是 round() 方法的语法: round( x [, n] ) 参数 ...

  4. Python3 reversed 函数

    Python3 reversed 函数  Python3 内置函数 描述 reversed 函数返回一个反转的迭代器. 语法 以下是 reversed 的语法: reversed(seq) 参数 se ...

  5. Python3 range() 函数用法

    Python3 range() 函数用法  Python3 内置函数 Python3 range() 函数返回的是一个可迭代对象(类型是对象),而不是列表类型, 所以打印的时候不会打印列表. Pyth ...

  6. Python3 chr() 函数

    Python3 chr() 函数 Python3 内置函数 描述 chr() 用一个整数作参数,返回一个对应的字符. 语法 以下是 chr() 方法的语法: chr(i) 参数 i -- 可以是 10 ...

  7. Python3 tuple 函数

    Python3 tuple 函数  Python3 内置函数 描述 tuple 函数将列表转换为元组.. 语法 以下是 tuple 的语法: tuple( seq ) 参数 seq -- 要转换为元组 ...

  8. Python3 bytes 函数

    Python3 bytes 函数  Python3 内置函数 描述 bytes 函数返回一个新的 bytes 对象,该对象是一个 0 <= x < 256 区间内的整数不可变序列.它是 b ...

  9. Python3 pow() 函数

    Python3 pow() 函数  Python3 数字 描述 pow() 方法返回 xy(x的y次方) 的值. 语法 以下是 math 模块 pow() 方法的语法: import math mat ...

随机推荐

  1. 免费获取 Kaspersky Small Office Security 90 天授权

    Kaspersky Small Office Security 是卡巴斯基出品的企业版杀毒软件,目前美国官网上官方有赠送活动,能够免费获取 90 天的授权,但必须要使用美国代理. 获取地址:http: ...

  2. sklearn 可视化模型的训练测试收敛情况和特征重要性

    show the code: # Plot training deviance def plot_training_deviance(clf, n_estimators, X_test, y_test ...

  3. 浅谈ES6的let和const的异同点

    1.let和const的相同点: ① 只在声明所在的块级作用域内有效. ② 不提升,同时存在暂时性死区,只能在声明的位置后面使用. ③ 不可重复声明. 2.let和const的不同点: ① let声明 ...

  4. 使用nginx反向代理处理前后端跨域访问

    本文主要解决:使用nginx反向代理处理前后端跨域访问的问题 1.何为跨域访问? 以下类型为跨域访问 1)不同域名间访问 www.zuiyoujie.com和www.baidu.com 2)同域名不同 ...

  5. Swapping eth0 and eth1 on OK335xS board

    /******************************************************************************* * Swapping eth0 and ...

  6. CF1143D/1142A The Beatles

    CF1143D/1142A The Beatles 将题目中所给条件用同余方程表示,可得 \(s-1\equiv \pm a,s+l-1\equiv \pm b\mod k\). 于是可得 \(l\e ...

  7. CentOS 6安装php加速软件Zend Guard(转)

    (尚未验证) PHP5.3以上的版本不再支持Zend Optimizer,已经被全新的 Zend Guard Loader 取代,下面是安装Zend Guard具体步骤,以下操作均在终端命令行执行 1 ...

  8. 【白银组】codevs_1011 数的计算

    简单而言,就是递归的运用,注意使用全局变量统计cnt,并且注意递归的结束,中间生成的值无需进行输出. http://codevs.cn/problem/1011/ #include<iostre ...

  9. xargs命令学习

    1.xargs复制文件 目录下文件结构为: . ├── demo1 │ ├── test.lua │ ├── test.php │ └── test.txt └── demo2 执行命令: find ...

  10. sql server利用cte递归查询

    1.数据环境准备 参考Oracle递归查询文章. 2.查询某个节点下的所有子节点 with cte(id,name,parent_id) as ( select id,name,parent_id f ...