>>> str(10)
>>> int('10')

Links to the documentation:

The problem seems to come from this line: d.str().

Conversion to a string is done with the builtin str() function, which basically calls the __str__() method of its parameter.

How to Convert a Python String to int – Real Python


Integers are whole numbers. In other words, they have no fractional component. Two data types you can use to store an integer in Python are int and str .

Convert integer to string in Python - Stack Overflow


There are several ways to convert an integer to string in python. You can use [ str(integer here) ] ...

Converting integer to string in PythonPython Principles


To convert an integer to a string, use the str() built-in function. The function takes an int as input and produces a string as its output.

String to Integer (atoi) - LeetCode


String to Integer (atoi) - Implement the myAtoi(string s) function, which converts a string to a 32-bit signed integer (similar to C/C++'s atoi function).