Back

Explore Courses Blog Tutorials Interview Questions
+3 votes
7 views
in Python by (3.4k points)
edited by

In Python how can I convert an integer to a string? I am trying this:

r = 16
r.str()

I am trying to convert it to a string but it's showing an error like int , I was hoping a str  attribute but there's nothing like that.

2 Answers

0 votes
by (2k points)
edited by

The error you are facing is because of d.str() , try this:

>>> str(20)
'20'
>>> int('20')
20

Doubts in comments, cheers......!! 

Learn python programming from an industry expert, enroll in our Python programming course

0 votes
by (106k points)
edited by

Try this:

str(i)

You can use the following video tutorials to clear all your doubts:-

If you are looking for upskilling yourself in python you can join our Python Certification and learn from an industry expert.

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
+1 vote
2 answers

Browse Categories

...