Built-in Functions and Types
repr()
Request a developer-oriented string representation. For many built-in values the result resembles a Python literal, but arbitrary objects need not produce executable or reconstructible expressions. Custom types implement __repr__(); the result must be a string. Unlike str(), a string representation includes delimiters and escapes where needed to show its structure.
Formal Syntax & Structure
python syntaxpython
repr(object, /)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| object | object | Value to represent; positional only. |
Return Value
str
Developer-oriented representation; not a serialization format.
Working Example
Example Snippetpython
value = "line\nnext"print(repr(value))print(repr(["ready", 7]))