• Register
Welcome to Kodlogs, programming questions and answer website.
0 votes
How to use python tostring?
by (9.7k points)  
reopened by

1 Answer

0 votes
Best answer
In Python, unlike in JavaScript, or Java, we do not actually have direct function "toString".

You can have it in one or two ways.

1. You can use ```str ( )``` Python function to change/cast the other Python data type to python string,

data = 1234
stringData = str(data)

2. or you can manually make your own function.
You can do so as in below:

```def toString(data):
        return str(data)

That's it.
by (480 points)  
selected by