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

Should I learn c before python?

1 Answers  


Why Lambda is used in Python?

3 Answers  


Is there any equivalent to scanf() or sscanf()?

1 Answers  


What are the differences between the threading and multiprocessing in python?

1 Answers  


What is a dictionary in python?

1 Answers  


How can we make forms in python?

1 Answers  


What is a python method?

1 Answers  


Draw a comparison between the range and xrange in python?

1 Answers  


Name few python web application frameworks?

1 Answers  


Why do lambda forms in python not have the statements?

1 Answers  


How to import a module given the full path?

1 Answers  


Can I create apps with python?

1 Answers  


Categories