How to output skeleton 3D coordinates after posing?

I am a newbie in blender.
I feel confused when looking at the python 2.61 api doc.

I have successfully output the posed mesh in the following way.

me = bpy.data.objects['figure'] 
mesh = me.to_mesh(sce, APPLY_MODIFIER, 'PREVIEW') 

#output vertices and faces to a .obj file
...

But when I am going to output the armature of this mesh, I don’t know how to do.
Any advice?

Solved.

I thought head_local is relative to its parent, and head is relative to the world.

Finally the code is simple.

ama = bpy.data.objects['Armature']
matg = ama.matrix_world.copy()
    
for obj in bpy.data.objects:
    if obj.type == 'ARMATURE':
        bones = obj.data.bones;
        for ab in bones:
            pt_head_global = matg * ab.head_local
            pt_tail_global = matg * ab.tail_local

Then coordinates are in the world CS.