List all kerning groups

Is there a sensible way (e.g. a script) to list all kernings groups that are present in the file? I don‘t mean the individual glyphs to belong to a group (e.g. A, Aacute, Abreve that belong to the A kerning group), but rather list the defined groups like so:
LSB: A, H, J, O, …
RSB: A, B, C, E, F, …

I am specifically asking for a list that I can copy and use programatically in my own script—I am familiar with the List View that allows to sort glyphs by their kerning group.

leftGroups = set()
rightGroups = set()
for glyph in Font.glyphs:
	if not glyph.export:
		continue
	
	leftGroup = glyph.leftKerningGroup
	if leftGroup is not None:
		leftGroups.add(leftGroup)
	rightGroup = glyph.rightKerningGroup
	if rightGroup is not None:
		rightGroups.add(rightGroup)
print(leftGroups)
print(rightGroups)
3 Likes