Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Python repr() Function

Python repr() Function

Python built-in function Python built-in function


Description

The repr() function converts an object into a form that can be read by the interpreter.

Syntax

The following is the syntax of the repr() method:


repr(object)

Parameters

Return Value

Returns the string representation of an object.


Example

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

s

=

'RUNOOB'

repr

(

s

)

"'RUNOOB'"

dict

=

{

'runoob'

:

'runoob.com'

,

'google'

:

'google.com'

}

;

repr

(

dict

)

"{'google': 'google.com', 'runoob': 'runoob.com'}"

Python built-in function Python built-in function