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 an operator in python?
Explain how to make Forms in python.
Does python have oops concepts?
Which operator will be helpful for decision making statements?
What is slicing in python?
Explain pickling and unpickling.
What is the difference between a list and a tuple?
What is the concatenation?
How do I publish a package in python?
What does end do in python?
What is polymorphism in python?
Can we develop a site using python