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
Is set iterable python?
What is the purpose of not in operator?
Is python scripting easy to learn?
Is multiple inheritances possible in python?
Tell me how do you debug a program in python?
What are the different environment variables identified by python?
What is proxy object in python?
How do you sort a dataframe in descending order?
Explain accessor and mutator methods in python?
What is the difference between 'is' and '==' in python?
What is subclass in python?
Give one example for multiple statements in single statement?
With python, how do you find out which directory you are currently in?
How long do goats sleep?
How do you find the current version of python?