Get/Set coordinates for UV vertices using Python

I got this UV map, and I want to set the position coordinates for all the four vertices to x=0.5 and y=0.5 (in the center of the green pixel).

I've already tried to use bpy.ops.transform.translate(value=(0,0,0)), but this moves the vertices relative to the current position. Is there a way to set specific coordinates/position for the UV vertices?

The uv coordinates are stored in 'loops':

You set ob.data.uv_layers.active.data[loop_index].uv = (0.5, 0.5)

You can see how loops work here:

# Loops per face
for face in ob.data.polygons:
for vert_idx, loop_idx in zip(face.vertices, face.loop_indices):
uv_coords = ob.data.uv_layers.active.data[loop_idx].uv
print("face idx: %i, vert idx: %i, uvs: %f, %f" % (face.index, vert_idx, uv_coords.x, uv_coords.y))

# Or just cycle all loops
for loop in ob.data.loops :
uv_coords = ob.data.uv_layers.active.data[loop.index].uv
print(uv_coords)

• and ob = bpy.context.active_object Aug 13, 2017 at 15:57