Chapters
Python114 chapters

ReferenceBuilt-in functions

repr()

The value written the way you would type it in code, quotes and escapes included.

Signature

repr(object)

Parameters

NameMeans
objectanything

Returns

A string, from the object's __repr__.

Example

Python
value = "line\twith a tab\n"
print(value)
print(repr(value))

Output

line	with a tab

'line\twith a tab\n'

See also