On this page
  1. builtins.hex
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

builtins.hex

Prev: builtins.help | Up: builtins | Next: builtins.id
Rel: builtins.abs, builtins.aiter, builtins.all, builtins.anext
Ref: docs.python.org — builtins.hex
Tags: #public #python3 #stdlib #builtins


Import

import builtins
from builtins import hex

Signature & Overview

builtins.hex(number, /)

Return the hexadecimal representation of an integer.

Usage

assert hex(255) == "0xff"
assert format(255, "04x") == "00ff"

Gotchas

REPL Inspect

from builtins import hex
help(hex)

Linked from

Related notes