
Python Tutorial
To convert the Int to String data type in Python is very easy.
There are two method can be used, str() and “%s”.
To give you an understanding let’s dive into the following example
First example
For the first time, we use the str() method, here’s an example:
x = 13
print("The value is "+ str(x))
The result is:
The value is 13
Second example
For the second version we use “%s”. However this must be followed by %variableName or %value. Here’s an example:
x = 13
print("The value is "+ "%s" %x)
The result is:
The value is 13
it’s very easy right?
Hopefully this article is useful. To see more about python, click here.
1 comment