Python

Python Menu

Python

Python hex() Function - Definition, Syntax, Parameters, Examples

Definition

The hex() function converts the specified number into a hexadecimal value.

The returned string starts with the prefix 0x.

Syntax

hex(n)

Parameters

Parameter Description
n Required. Integer.

Examples

myHex = hex(256) print(myHex)

Introduction

Python Basics

Python Advance

Data Science Python Tutorials

Python Functions and Methods