Python – Find Object Printable Representation – repr() Function with Examples

repr() function is used to find the a printable representation of the given object in Python for the given input.

repr() function is a part of Python Built-in Functions.

Syntax of repr() Function

The syntax of repr() function in Python is:

repr(obj)

 

Parameters of repr() Function in Python

x – Where x is any valid . This parameter is required.

 

Compatibility

repr() function is available and compatible with both Python 2.x and 3.x.

 

Return Value of repr() Function in Python

repr() function returns a printable representation of the given object for the given input.

 

Python repr() Function Example 1

Example CODE

Output:

 

Python repr() Function Example 2

Example CODE

Output: