logo-MindMajix
PostPythonPython
H
Harshel Mike

Posted on 20th June 2024|19 views

0
votes

Python Integer To String

How to convert an integer to string in python?

1 answers
Answers
P
imran mohammad

Posted on 20th June 2024| views

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
Name
Course *
Email *
Phone Number