# Remove object from specific group programmatically

Somehow I have managed to add objects to a group called "myGroup" without actually wanting to do that. I now want to remove all those objects from that group, which at the same time were already assigned to another group. I figured the best way would be to do that in python. I tried the following:

allObjects = bpy.data.objects;
for obj in allObjects:
count = 0;
found = 0;
for gr in obj.users_group:
count = count + 1;
if gr.name == 'myGroup'
found = 1;
if count > 1 and found == 1
for object in bpy.context.visible_objects:
object.select = False;
obj.select = True;
REMOVE obj from group myGroup!!!!


I do not know how to put the last line into valid python code. I know that there is a function could "bpy.ops.object.group_remove()", but I do not understand which group the object is deleted from when I call this function. Any help? :)

bpy.ops.group.objects_remove(group="myGroup")