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 |
Define pyramid in python?
What is meant by“call by value” in python?
Tell me the use of the split function in python?
How useful is python?
How can I find methods or attributes of an object in Python?
post me some questions from pythom script
What is the output of this line?
Is python written in python?
How can I learn python?
Is numeric in python?
What is sphinx python?
How to capitalize the first letter of each word in a string (python)?