repr()
Returns an unambiguous, developer-friendly string — what the REPL shows.
Beginner
repr("hi") # "'hi'" (with quotes)
str("hi") # 'hi'
Define __repr__ on your classes for useful debugging output.
Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.
Discussion (0)
Sign in or join free to ask questions and discuss this topic.