I need some help in removing all material slots in one go using a python script.
I am able to use this, would prefer to ave all removed.

    bpy.context.object.active_material_index = 0
    bpy.ops.object.material_slot_remove()
    bpy.context.object.active_material_index = 1
    bpy.ops.object.material_slot_remove()
    bpy.context.object.active_material_index = 2
    bpy.ops.object.material_slot_remove()