Finding vertices in a Vertex Group using Blender's Python API Is there an easy way to get the vertices in a vertex group?  The only way I've found is pretty brute-force - e.g., to find the vertices of object obs[i] in group "e":

e_idx = obs[i].vertex_groups['e'].index
vs=[v for v in obs[i].data.vertices if (v.groups)]
for v in vs:
    for g in v.groups:
        if (g.group == e_idx):
            es[i].append(v)
            break


Isn't there an easier way?  I just found almost identical code in the "Similar Questions", so maybe this is the best there is.
Methods

1. List comprehension

As mentioned by Pycoder in the comments below, using operators is often slow. So a quicker and simpler (and X2 faster) method to get all the verts that belong to a certain vertex group index:

vg_idx = 0
o = bpy.context.object
vs = [ v for v in o.data.vertices if vg_idx in [ vg.group for vg in v.groups ] ]


2. bpy.ops

You can also use the bpy.ops.object.vertex_group_select operator in edit mode:

import bpy

o = bpy.context.object

bpy.ops.object.mode_set( mode = 'EDIT' )

# Set the first vertex group as active:
o.vertex_groups.active = o.vertex_groups[0]

# Deselect all verts and select only current VG    
bpy.ops.mesh.select_all( action = 'DESELECT' )
bpy.ops.object.vertex_group_select()

# Now the selected vertices are the ones that belong to this VG
vgVerts = [ v for v in o.data.vertices if v.select ]


3. Optimization if only one group

If there is only one group, this is a more optimized way to get the verts that belong to it. Note that this only works if there is only one vertex group.

vertices = [v for v in obj.data.vertices if v.groups]


Performance testing

1. List comprehension

With the default cube (8 vertices), this was timed 1,000,000 times, and had a minimum value of:


  0.000003528 seconds


With the default cube subdivided 8 times (393,218 vertices), this was timed 1,000 times, and had a minimum value of:


  0.1528 seconds


2. bpy.ops

With the default cube (8 vertices), this was timed 10,000 times, and had a minimum value of:


  0.0003289 seconds


With the default cube subdivided 8 times (393,218 vertices), this was timed 100 times, and had a minimum value of:


  0.8849 seconds


3. Optimization if only one group

With the default cube (8 vertices), this was timed 1,000,000 times, and had a minimum value of:


  0.00000222 seconds


With the default cube subdivided 8 times (393,218 vertices), this was timed 1,000 times, and had a minimum value of:


  0.0659 seconds


Here is a graphical (but less accurate) model if the performance. Each point is the min of 100 iterations.



Another representation of it:



Because the higher subdivision values make the lower end almost meaningless, we can use a logarithmic scale to see everything a bit more clearly:



Additional links

https://blenderartists.org/forum/showthread.php?304054-Getting-vertices-of-a-vertex-group-from-within-Python

Checking if a vertex belongs to a vertex group in python

How can i get the weight for all vertices in a vertex group?

vertex groups and bone weights programmatically

How can I get the names of the vertex groups these vertices are in?