Alias Wavefront OBJ Export in Maya Python with Examples
Before I start I wanted to explain why I think this is a classic exercise
If you can represent a mesh in OBJ text format you pretty much understand how the data polygonal data exists in the package you are using and you have enough skill to pack it into a data structure to put it to disk.
So here is what you should get a good understanding of: