Export texture uv coords of vertices?

Hello!
i have structure of vertex:


struct VERTEX { float x, y, z, u, v; };

and i wrote function:


def uv_list(ob):
    uvs = []
    fac = ob.data.faces
    uv = ob.data.uv_texture_clone
    vs = ob.data.vertices
    for v in vs: # enumerate all vertices
        for f in fac: # enumerate all faces and compare indices
            p = f.vertices # get indices of vertices
        # mesh was converted to tris (check only first 3 vertices)
            if(v.index == p[0]):
                uvs.append(uv.data[f.index].uv1)
                break
            if(v.index == p[1]):
                uvs.append(uv.data[f.index].uv2)
                break
            if(v.index == p[2]):
                uvs.append(uv.data[f.index].uv3)
                break
    return uvs

this function collects all uv coordinates of vertices. it working, but result is bad

using:


uvs = uv_list(ob)
vrt = ob.data.vertices

for v in vrt:
    fout(v, uvs[v.index])

may be have is another way to get the coordinates of the vertices?
please, help me!