Post

PythonPython

H
Harshel Mike

Posted on 4th March 2024|14 views

0
votes

Python Integer To String

How to convert an integer to string in python?

Answers
P
imran mohammad

Posted on 4th March 2024

Let us see the two different methods by which an integer type can be converted into the string type

Method 1:

Use str()

numb = 30

print(type(numb)) 

converted_numb = str(numb)

print(type(converted_numb))

Output:

<class ’int’>    

<class ‘str’>

 

Method 2:

Use the “%s” keyword

numb = 40

print(type(numb)) 

"% s" % numb

Output:

<class ‘int’>

 

Write your answer

STILL GOT QUERIES?

Get a Live FREE Demo
  • Explore the trending and niche courses and learning maps
  • Learn about tuition fee, payment plans, and scholarships
  • Get access to webinars and self-paced learning videos