Easy Tutorial
❮ Python File Fileno Python File Methods ❯

Python repr() Function

Python Built-in Functions


Description

The repr() function converts an object into a form readable by the interpreter.

Syntax

Here is the syntax for the repr() method:

repr(object)

Parameters

Return Value

Returns a string representation of the object.


Examples

The following examples demonstrate the use of the repr() method:

>>> s = 'tutorialpro'
>>> repr(s)
"'tutorialpro'"
>>> dict = {'tutorialpro': 'tutorialpro.org', 'google': 'google.com'};
>>> repr(dict)
"{'google': 'google.com', 'tutorialpro': 'tutorialpro.org'}"
>>>

Python Built-in Functions

❮ Python File Fileno Python File Methods ❯