Do you know you can earn heaps of $$ by answering questions on kodlogs, for more info contact us through feedback link at footer? We are Australian based web site and pay you for answering questions

  • Register
Welcome to Kodlogs Q&A, where you can ask programming questions and receive answers from other members of the community. For programmers, by programmers Kodlogs is an open community for anyone that does coding. We help you get answers to your toughest coding questions, share knowledge with your coworkers in private, and find your next IT dream job.
0 votes
How to use python tostring?
by (8.8k points)  

1 Answer

0 votes
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 (180 points)