0
What is the use of python "repr()" function?
2 Réponses
+ 3
It converts values to strings.
The difference to str() is mostly about the meaning.
str focuses on how to convert a value into string.
repr focuses on how to represent value as a string.
Results of str and repr are often very similar, but:
-repr is about twice faster than str.
-When you use repr for a value, which already is a string, you get extra quotes.