# How to get a list of faces with corresponding indices?

I am trying to get a list of faces that has each index of the 3 vertices that go with it. I thought about just doing it from scratch but they are kinda in random order. I am looking for a list that's like this: I also attached an image to make it more clear to what im looking for... thanks for help!

Faces = [
(0,1,3),
(0,2,3),
(0,2,40)
#and so on and so forth...
]


This code should give you the face's verts indices:

import bpy
import bmesh
obj = bpy.data.objects['Cube'] #Using default cube as example

bm = bmesh.new()
bm.from_mesh(obj.data)
bm.faces.ensure_lookup_table()
vert_idx = []
for f in bm.faces:
vert_idx.append([v.index for v in f.verts])
print(vert_idx)