The repr() function is used to get the printable string representation of an object.  

Syntax:
repr(object)
copy

The single argument , object,  can be any valid value such as an integer, a string, lists, a user-defined class, a function, etc.

ExampleEdit & Run
print( repr(1) )

print( repr(list) )

print( repr("Python") )

print( repr(True) )

print( repr({1:'one'}) )
copy
Output:
1 <class 'list'> 'Python' True {1: 'one'} [Finished in 0.01058853231370449s]

The built-in print() function actually prints the string returned by repr(object) .

User defined objects can customize their printable representation by overriding the __repr__() method.

ExampleEdit & Run
class Example1:
     def __init__(self):
        self.name = 'Instance'
e1 = Example1()
print(e1)

class Example2:
    def __init__(self):
        self.name = 'Example2 Instance'
    def __repr__(self):
        return self.name
       
e2 = Example2()
print(e2)
copy
Output:
<__main__.Example1 object at 0x7f61fc12efd0> Example2 Instance [Finished in 0.010149202309548855s]