obtain a list of all selected vertices

how do you obtain a list of all selected vertices in python


import Blender 
 
Blender.Window.EditMode(0) 
 
 
me = Blender.Object.GetSelected()[0].getData(mesh=1)

#Now that we've got access to the object:

verts = []

for vert in me.verts:
 if vert.sel == 1 : verts.append(vert.index) # if the vert is selected add it's index to the list.

alternatively, you can use the selected() function of MVertSeq:


import Blender 
from Blender import * 

me = Object.GetSelected()[0].getData(mesh=1)
for x in me.verts.selected(): 
  # do something to the selected verts
  print me.verts[x].co

thanks albertoEAF and ncy- that helps a lot, I sat for quite a few unfruitful hours trying to figure it out…