How to select vertices from a circle and change there location

Hello!
Please excuse my bad english.
I hope someone can help me. I´m writing a phython script for blender and have a problem.

I have import a circle with a number of vertices,gave them a texture and exported it.

Now I wannt to write an script wich opens this object and change the location of each vertice to a point that is saved in a csv file. My Problem is that I don´t now how to select a vertice and give them a new location. (to open the object and get the informations from the csv file works very well)

I thougt it has to look like this:


i = 1
context=bpy.context
bpy.ops.import_scene.obj(filepath)

for obj in context.selected_objects:
while (i<10):
x = (X_location[i])
y = (Y_location[i])
z = (Z_location[i])
obj.vertices[i].select = True
obj.vertices.location = (x,y,z)
i = i +1

The X, Y, Z_location are imported from the csv file.

If someone coud help me I woud be very grateful!!!

You don’t have to select them if you change .location, you only need to if you want to use the transform.translate() operator.

for ob in context.selected_objects:
    if ob.type == 'MESH':
        for v in ob.data.vertices[:10]:
            x, y, z = X_location[v.index], Y_location[v.index], Z_location[v.index]
            v.co = x, y, z

Thanks a lot ‘CoDEmanX’!
With your help I found a way … I changed it only a little bit:

while (i < 10):
x = listx[i+1]
y = listy[i+1]
context = bpy.context

for obj in context.selected_objects:
    if obj.type=='MESH':
        for v in obj.data.vertices[i : (i+1)]:
            v.co = x,y,z
i = i+1

it works very well!