Iterate through many objects with the same name

Hi there,
sorry, my english sucks.
How to iterate through a lot of objects with the same name like sphere.001, sphere.002 …
I want to assign a emission material to all these objects.
Thanx.

:slight_smile:


import bpy

for ob in bpy.data.objects:
    is_name_like = ob.name.find("sphere")
    if is_name_like != -1:
        print(ob.name)
        # Assign material to this object.


thanks, works fine.