#!/usr/bin/python
import yum
yb = yum.YumBase()
yb.doConfigSetup()
yb.doTsSetup()
for grp in yb.comps.groups:
print "%s (%s)" % (grp.name,grp.groupid)
This is posted in my howto alsoTo list the package groups available in yum, you would use yum grouplist. When you are adding groups to your kickstart file, you use the id of the group not the name, so this *very* simple script lists the groups with their ids.