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 is the difference between numpy and pandas?
Is there a switch or case statements in python?if not what is the reason for the same?
What is os module will do in python?
Explain me what is python and explain some of its benefits?
What can you use Python generator functions for?
How would you display a file’s contents in reversed order?
When would you use triple quotes as a delimiter?
What are python decorators? 8) What is the difference ...
How do you get all values from a python dictionary?
How do I run python setup py?
How does break, continue and pass work?
What is a super constructor?