Python hex() Function

Converts a number to its hexidecimal value.

Syntax

Python
hex(number)

Parameters

ParameterDescription
number Required. The value to convert

Example

Python
print(hex(12648430))

Output

0xc0ffee