Python: Insert property into string

So I have a property called frame which as an integer that cycles form 0 to 16 when you hold down a certain key. Now I want this number to be the suffix of a string so if

frame = own[‘frame’]
walk = (“walk_”(frame))
walk should return walk_3 or whatever the frame property was on. But I get ‘str’ object is not callable?
I’m a bit noobish when it comes to python and I think I miss the fundamentals but that to me, seemed like it should work. Can somebody tell me what I’m doing wrong?

Thanks all. :confused:

you forgot the + i think:

walk = (“walk_”+(frame))

walk = “walk_”+frame

If frame is an int, you may get an error concatenating it to a string. If this happens typecasting it should do the trick:

walk = "walk_" + str(frame)

Alternatively, you could also use string formatting:

walk = "walk_%d"%frame

There is also another way to do string formatting these days in python, but I usually stick to % operator.

Ah, thanks for the quick reply. Thats seems to have done something. Now I get >cant convert ‘int’ object to str implicity<. What does that mean? I tried making the int a float but returned the same just cant convert ‘flaot’ object.

Any thoughts?

Ah another speedy reply. Thanks Kupoman I will try that.

All working, thanks to the both of you for your speedy replies. :slight_smile: