hex()

Published May 26, 2023Updated Oct 13, 2023
Contribute to Docs

The hex() function converts an integer number to a hexadecimal string with the prefix 0x.

Syntax

hex(integer)

The value integer is the value the hex() function will convert to a hexadecimal string.

Codebyte Example

In the code below the hex() function is used to convert a list arr of integers to hexadecimal.

Code
Output
Loading...

All contributors

Looking to contribute?

Learn Python on Codecademy