One Way
# assuming the object is currently in Edit Mode.
import bpy
import bmesh
obj = bpy.context.edit_object
me = obj.data
bm = bmesh.from_edit_mesh(me)
for f in bm.faces:
if f.select:
print(f.index)
# Show the updates in the viewport
# and recalculate n-gon tessellation.
bmesh.update_edit_mesh(me, True)
Another Way
import bpy
import bmesh
from bmesh.types import BMFace
obj = bpy.context.edit_object
me = obj.data
bm = bmesh.from_edit_mesh(me)
for geom in bm.select_history:
if isinstance(geom, BMFace):
print(geom.index)
bmesh.update_edit_mesh(me, True)
Further Reading
I encourage you to know what the documentation says.
blender.org/api/blender_python_api_current/bmesh.html?