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 |
Can python be used for automation?
Explain the ternary operator in python?
What is time sleep in python?
What is the best interpreter for python?
How to do relative imports in python?
What is anaconda program?
Explain about the dictionary function in python?
What does the 'yield' keyword do in python?
What is metaprogramming in Python?
Is geany free?
How can we get home directory using '~' in python?
What are the different types of reuest in python?