Python repr() Function
Description
The repr() function converts an object into a form that the interpreter can read.
Syntax
The following is the syntax for the repr() method:
repr(object)
Parameters
- object -- An object.
Return Value
Returns a string format of an object.
Example
The following shows an example of using the repr() method:
>>> s = 'EXAMPLE'
>>> repr(s)
"'EXAMPLE'"
>>> dict = {'example': 'example.com', 'google': 'google.com'};
>>> repr(dict)
"{'google': 'google.com', 'example': 'example.com'}"
>>>
>>> repr(s)
"'EXAMPLE'"
>>> dict = {'example': 'example.com', 'google': 'google.com'};
>>> repr(dict)
"{'google': 'google.com', 'example': 'example.com'}"
>>>
Python Built-in Functions