208k views
13 votes
In Python, when do we use the str( ) function

User Sajadkk
by
5.2k points

1 Answer

8 votes

Answer:

Both str () and repr () methods in python are used for string representation of a string.

Step-by-step explanation:

Though they both seem to serve the same purpose, there is a little difference between them. Have you ever noticed what happens when you call a python built-in function str (x) where x is any object you want?

User Jesper Jensen
by
5.5k points