How to remove extra materials from a mesh if the mesh has more than 1 material?
You can set the index of the list to 1, iterate through the upcoming slots, call and override the context of material_slot_remove(). Demo on how to remove all slots &gt; 0:
for obj in bpy.context.selected_editable_objects:
    obj.active_material_index = 1
    for i in range(1, len(obj.material_slots)):
        bpy.ops.object.material_slot_remove({'object': obj})