Joining property value

I wanna join some text with object property value. Something like that:


import GameLogic
cont = GameLogic.getCurrentController()
obj = cont.owner

MyProperty = obj["Property"]

seq = ("aaa", MyProperty, "bbb");
MyJoinedText = "".join( seq );

print(MyJoinedText)

…and it’s not working, beacuse can’t read property value :frowning:

Any ideas how to fix it?

It’s not very clear what you really want. Do you want a string of a list, or do you want to join the strings of items in a list? What are you trying to do actually?

I just have a simple string text in Property.
Something like obj[“Property”] = MyText_123

After join it should be: aaaMyText_123bbb

a = “aaa”
b = “bbb”
myPropertyValue = obj[“myProperty”]

joined = a + myPropertyValue + b

you could join by just concantenating them in seq and turning MyProperty to a string

seq = “aaa”+ str(own[“MyProperty”])+“bbb”

Edit: Whoops, Monster beat me. i only use the str() because i assumed MyProperty was a number or something

indeed if your property does not contain a string value you should convert it to a string first. Simplest way: str().