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
What is the __ init __ method used for?
What does len () mean in python?
How do you execute a python script?
What is a means by “tuple in python”?
What is tuple when we have to use ?
How can you sort a list in reverse order in python?
What is a variable in python?
What is multithreading? Give an example?
What is split used for?
In python, how can you generate random numbers?
Explain other string literals?
What is meta class in python?
What is python keyword?
Can python be used for web client and web server side programming? And which one is best suited to python?
Why is using ‘eval’ a bad practice?