Explain the role of repr function.
Answer / chaitanya
Python can convert any value to a string by making use of two functions repr() or str().
The str() function returns representations of values which are human-readable, while repr() generates representations which can be read by the interpreter.
repr() returns a machine-readable representation of values, suitable for an exec command.
Following code sniipets shows working of repr() & str() :
| Is This Answer Correct ? | 0 Yes | 0 No |
What do you understand by the process of compilation and linking in python?
Why python is best for data science?
What is nose python?
How do I run a py file in python shell?
What is self in python?
What is the interactive mode?
How can I find the methods or attributes of an object?
Does python use ram?
Is map faster than for loop python?
Why python is the best?
When does a dictionary is used instead of a list?
What is a control flow statement?