Explain the role of repr function.



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

Post New Answer

More Python Interview Questions

What is the difference between numpy and pandas?

0 Answers  


Is there a switch or case statements in python?if not what is the reason for the same?

0 Answers  


What is os module will do in python?

0 Answers  


Explain me what is python and explain some of its benefits?

0 Answers  


What can you use Python generator functions for?

0 Answers  






How would you display a file’s contents in reversed order?

0 Answers  


When would you use triple quotes as a delimiter?

0 Answers  


What are python decorators? 8) What is the difference ...

0 Answers  


How do you get all values from a python dictionary?

0 Answers  


How do I run python setup py?

0 Answers  


How does break, continue and pass work?

0 Answers  


What is a super constructor?

0 Answers  


Categories