Search the Community
Showing results for tags 'str'.
In the Python SOP, I've run into a wall trying to get an integer converted to a string. In the larger picture, I'm trying to subtract 1 from a value which is currently part of a string. There are probably neater ways to write these steps, but I'm fairly new to Python so I'm writing it all out to make things easier to follow. I start with a string such as: string = "f27" Then remove the 'f' like so: string = string[1:] Convert it to an integer: integer = int(string) Subtract 1 from the value: integer -= 1 set new string string_new = "f" + str(integer) The last line returns an error on the Python SOP: TypeError: str() object is not callable. This is confusing because these same steps work just fine in the Python shell. Is there an alternative to str(), or am I using it wrong?