Python int to string

Python int (or any other data type like float) needs to be converted to string before we can do concatenation operation using plus (+). It can be done using str(intval). Here is quick example to convert int to string.

v = 7
s = "Hello" + str(v)
print s
Hello7
Env: Python 2.7.6
Share this article: share on Google+ share on facebook share on linkedin tweet this submit to reddit

Comments

Click here to write/view comments