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
How to prevent blocking in content() method of socket?
What is a raw input?
What does head () do in python?
Explain docstring in python?
How would you check if MySQLdb is installed?
Explain the use of ternary operator in python?
What is the __ init __ method used for?
How to save an image when you know the url?
How do you get all values from a python dictionary?
How do you alphabetize a list in python?
What should I learn in python?
What is dogpile mechanism? Explain.
Does .net support python?
Does python supports interfaces like in java or c#?
What is the zip() function in python?