How to export UVs per-vertex in script (as OBJ format does)?
If you are aiming to use UV coordinates with OpenGL, at some step, you'll have to use instructions like this one:

   glBegin(GL_QUADS);
   glTexCoord2f(0.0, 0.0); glVertex3f(-2.0, -1.0, 0.0);
   glTexCoord2f(0.0, 1.0); glVertex3f(-2.0, 1.0, 0.0);
   glTexCoord2f(1.0, 1.0); glVertex3f(0.0, 1.0, 0.0);
   glTexCoord2f(1.0, 0.0); glVertex3f(0.0, -1.0, 0.0);

   glTexCoord2f(0.0, 0.0); glVertex3f(1.0, -1.0, 0.0);
   glTexCoord2f(0.0, 1.0); glVertex3f(1.0, 1.0, 0.0);
   glTexCoord2f(1.0, 1.0); glVertex3f(2.41421, 1.0, -1.41421);
   glTexCoord2f(1.0, 0.0); glVertex3f(2.41421, -1.0, -1.41421);
   glEnd();


Which means that:


UV coordinates are given per vertex...
... but given per vertex only in the scope of a drawn face


So we have, in fact a per face information.

In your export program, you may:


Loop over the vertices to store their coordinates
Loop over the faces to store the vertices they use (e.g. making fan polygons)
Loop over the UV maps, and for each:
Loop over the polygons (at obj.data level)
Loop over each polygon's loop_indices and take the corresponding data (uv coordinates) in the current UV map.


This can be something like this (code template):

import bpy

obj = bpy.context.object #An object (selected one)

#Write 3D coordinates
for v in obj.data.vertices: 
    #Write v.co in your file
    pass

#Write polygons (faces)
for p in obj.data.polygons: 
    #Write a line per polygon indicating the vertices it uses
    for i in p.vertices:
        #Write i in your file  
        #See explanation 1 below  
    pass

#Write each uv map
for uvMap in obj.data.uv_layers:
    #Process this uvMap
    for p in obj.data.polygons:
        #Use the polygon loop indices
        for li in p.loop_indices:
            #Write the uv coordinates for each vertex in the uv map
            uvMap.data[li].uv
            #See explanation 2 below


Explanation 1 (see comments in code):

The indices stored here refer to the previously written 3D coordinates in the same order they've been written

Explanation 2 (see comments in code):

The uv coordinates stored here correspond to the polygons vertices indices in the same order they are written previously in the polygons part