+3 votes
4 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......!! 

0 votes
by (107k points)

Try this:

str(i)

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

Related questions

+1 vote
2 answers
0 votes
1 answer
asked Sep 17, 2019 in Python by Sammy (47.8k points)
0 votes
1 answer
0 votes
1 answer
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...