Cutting Strings

Hi guys,
This may not seem like a game engine question, but I need it for a game so I guess I would put it here. Anyways, I have used str() to get then string name of a blender object, but blender has gone and slapped OB on the front of the name, changing Armature to OBArmature, how would I cut off the OB and make the string just say Armature?

I don’t believe you can ‘cut’ the OB from in front of the object, but if you need to call the object in the script, just cope with blender and slap an OB (OBArmature) in front of it as well. It makes since to me cause you have to differentiate between objects and materials and so on so forth

edit: ok, just read back over and I think I understand what you mean. My only question is why do you need it to be displayed that way? Or displayed at all?

You can ‘cut’ the string using slicing. If you are familiar with slicing lists then its the same with a string:

str1 = 'OBCube'
str2 = str1[2:]

print str2 # 'Cube'

Just google slicing python lists if you need more info.

>.< I was going to recommend that, but I didn’t understand what he meant. I thought he was talking about taking OB out on blender interface, not in code, but then again I’m a bit flustered at the moment trying to figure out some coding that wasn’t well explained.

That works, thanks.