Answer Posted / 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 View All Answers
Can I use Python instead of PHP?
Is true a keyword in python?
How to change a string in list ?
Does xrange work python 3?
What happens if an error occurs that is not handled in the except block?
How to read a 10gb (or larger) file size in python?
What is the difference between while and for loop?
What is list comprehension? Give an example.
What is the difference between locals() and globals ()?
Is google made with python?
Use of double quotes and single quote in python?
What are tuples used for?
Explain what is namespace in python?
What is uuid used for?
What happens in the background when you run a python file?