Trying my_int.str() gives an error saying int doesn’t have any attribute called str.

1
13

>>> 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.

Leave a Reply

Your email address will not be published. Required fields are marked *