What is the difference between `__str__` and `__repr__` methods in Python?
Answer Posted / nashiinformaticssolutions
`__str__` is used for creating a user-friendly string representation of an object. `__repr__` is used for creating a detailed string representation of an object, intended for debugging.
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Explain about pickling and unpickling?
What is pickling and unpickling in python?
What is the dictionary in Python?
Do you need classes in python?
What is design pattern in python?
How to convert a list into a set?
How to call an external command in python?
Are strings mutable in python?
What does pep8 refer to?
Write a code to display the current time.
What are the programming-language features of python?
What is raise keyword do in python exception handling?
Is python string mutable?
Does range start at 0 python?
What is difference between sort and sorted in python?