Hi,
I’m pretty noob with Python and Blender API, but I think this should work. Select your target armature, I don’t think it matters if you are in edit or object mode. Simply replace the dictionary items with your data.
import bpy
def rename_bones():
dict = {
'bone0': 'foo0',
'bone1': 'foo1'
}
for b in bpy.context.object.data.bones:
if b.name in dict.keys():
b.name = dict[b.name]
rename_bones()
That .keys if will allow you to skip incorrectly named bones or extra bones which don’t have their name in dictionary.