To remove group of edges and faces before I export the mesh using Python script

The dump file after deleting the groups uses internal group names which cannot be used to automate for multiple cases. I have a list of group names, which I want to remove from mesh file after union. How do I do it? I basically use these groups to refine the mesh, but I don’t need them while I export them.

My understanding may be incorrect, but perhaps you could simply create a group consisting solely of volume elements (by filtering on SMESH.VOLUME) and export it.
You could experiment with this interactively and then generate a Python script of the actions to see the implementation in python.
Below an example:
SF1815.py (2.9 KB)

Hello,
a cleanner way to do it, is (if you saved the mesh groups objects):
[Mesh_1.RemoveGroup(group) for group in groupsToRemove]
and voilà!
i use this as when importing meshes to openfoam with edges groups, it makes explodes the importing application.