Python repr() function

Published February 16, 2022

A repr() method is a Python built-in function that returns a string representation of an object. With repr(), a Python object can be represented as a printable representation.

Syntax
The following is the syntax of the repr(object):

repr(object)

where Object: is the object whose printable representation can be displayed.


Example

x = 'My Python'
print(repr(x))


Output

'My Python'

 

Download Source code

 

Article Contributed By :
https://www.rrtutors.com/site_assets/profile/assets/img/avataaars.svg

235 Views