How to get material_index from individual faces in a Blender 2.8 Script
I used faces, I'm pretty sure that's what you were going after . It requires you are in edit mode to work and a mesh is currently selected.
import bpy
import bmesh

ob = bpy.context.object
assert ob is not None and ob.type == 'MESH', &quot;active object invalid, select a mesh&quot;
materials = ob.data.materials.items()
mesh = bmesh.from_edit_mesh(ob.data)
indexes = [[face.index, face.material_index] for face in mesh.faces]
material_indexes = []
for index in indexes:
    tuple = (index[0], materials[index[1]])
    print(tuple)
    material_indexes.append(tuple)

Result:
(0, ('mat2', bpy.data.materials['mat2']))
(1, ('Material', bpy.data.materials['Material']))
(2, ('Material', bpy.data.materials['Material']))
(3, ('Material', bpy.data.materials['Material']))
(4, ('Material', bpy.data.materials['Material']))
(5, ('Material', bpy.data.materials['Material']))

if you need just the material_index, you can take it back a step:
print(indexes)