How to Convert Int to String in Python Easy

Each value in Python has a specific data type. A data type is a classification of data that tells interpreter or compiler that how programmer wants to use data. Every programming language has a different data type.

Mostly, the programmer needs to change some data types, so that it becomes easier to use.

In certain conditions, you need to convert integer to string in Python. Unlike other languages, Python does not typecasts integer to strings automatically.

However, a very useful function “str()” can help you to convert the argument to string. The str() function creates such visual representation which people can understand easily.

If you do not convert int to string in python, it may cause error. So, you should convert integer to string to avoid errors and to align the results into table. In this tutorial, you will learn how to convert int to string in Python with the help of examples.

How to Convert Int to String in Python

Int to String in Python

You can convert an integer to using by only three small steps. These steps are mentioned below;

  • First of all launch you Python Editor.
  • Type function “str (int)”.
  • Finally press Enter, this will run the function and convert integer to string.

Examples to Convert Int to String

 Following examples will help you to understand this example more effectively. However, if you still do not understand you can ask in comments.

Example 1

In this example, a mathematical function will be performed and then str will convert it into string.

i = 110.0/59.0

s = str(i)

print i

Example 2

In the following example, add 6 as the integer. Then, the str function will convert your integer to string and print out the result.

print ( “Enter any integer of your choice “,) answer = input ()

 integer = int (answer) addSix = integer +6

 print ( “Adding 6 to your integer, we get the answer ” +str (addSix))

Example 3

Also watch this simple example;

Python int to string


With the help of above mentioned examples, you will be able to convert integer to string in Python.

If you do not str to convert int to string, Python will show you error “TypeError: cannot concatenate “str” and “int” objects”.

Other resources –


About Andrei Ionut

Blogger and tech addict.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.


How to Enable Call Recording on EMUI 8

How to Convert String to Integer or number in Python