Difference between str and repr in Python

by Ikram Kurdi on Monday, May 18, 2009
Both of them convert values to strings, str changes the look of the value, while repr keeps its looks. str converts the data to a reasonable looking format, in other words it translates the data. While repr just takes a picture of the data and draws it again in string format, thus not changing its look.

Comments

Leave Comment

Commenting Policy

We never censor comments based on idiological point of view. We only delete those comments that are abusive, off-topic, or use offensive language.

We moderate comments after they have been published.