How to get the Index of a Material by its name ?

How can I get the Index of a Material by its name ?

I’ve not found anything about it on the net.

Later I wanna assign that Index Number to the Material Index of a Polygon.
Or is there an other way to assign a Material to a polygon by Materialname instead of Material Index ?

Kind regards
Alain

You can use .find():

ob = bpy.context.object
index = ob.data.materials.find("Material Name")
if index != -1:
    # found it