removing vertex groups that got a dot on its name
Each item vg when iterating over object.vertex_groups is an instance of
a bpy.types.VertexGroup object.  (just as each of bpy.data.objects is an instance of an bpy.types.Object object)
Remove vg from the objects vertex group collection with
ob.vertex_groups.remove(vg)  A vertex group object also has a remove method, which takes a sequence of vertex indices as an argument. Eg vg.remove([0, 1]). This prob led to the confusion re error message
No need to escape out the period.

&gt;&gt;&gt; str("\.") 
'\\.'

If a substring is not in string then find(...) returns -1


Script:  

import bpy
context = bpy.context

ob = context.object
vgs = [vg for vg in ob.vertex_groups
       if vg.name.find(".") != -1]

while(vgs):
    ob.vertex_groups.remove(vgs.pop())


To make the scripts portable (copy paste jobs) I like to break down variables.  Eg one edit to test with ob = context.scene.objects.get("Cube") no matter what the context object.

I favour the "while pop" method, a for vg in vgs: ob.vertex_groups.remove(vg) statement can also be used.  The rationale being once an object is removed in blender, trying to re-reference it can have dire consequences... (well sometimes crash blender)