Trying my_int.str()
gives an error saying int
doesn’t have any attribute called str
.
1
>>> str(10)
'10'
>>> int('10')
10
Links to the documentation:
int()
str()
Conversion to a string is done with the builtin str()
function, which basically calls the __str__()
method of its argument.