Export objects rotation animation to textfile
Using the example in the page you mentioned, it would be something like:

# import the necessary modules we need
# in our case, blender's python API and python's os module
import bpy, os
from math import degrees

# get the current selection
selection = bpy.context.selected_objects
scene = bpy.context.scene
startFrame = scene.frame_start
endFrame = scene.frame_end
currentFrame = scene.frame_current

# get path to render output (usually /tmp\)
tempFolder = os.path.abspath (bpy.context.scene.render.filepath)
# make a filename
filename = os.path.join (tempFolder, "newfile.txt")
# open a file to write to
file = open(filename, "w")


# iterate through the selected objects
for sel in selection:
    #cycle trough all the animated frames
    for i in range(endFrame-startFrame+1):
        #get true frame number
        frame = i + startFrame
        #set frame and get the object's rotation
        scene.frame_set(frame)
        rot = sel.rotation_euler
        file.write("%s - frame %d - X:%f Y:%f Z:%f \n" % (sel.name, frame, degrees(rot.x), degrees(rot.y), degrees(rot.z)))

# close the file
file.close()

#restore original frame (not necessary)
scene.frame_set(currentFrame)


NOTE: there are more reliable ways to do it (like using fcurve data, etc...), but for simple uses this method is perfect.

NOTE 2: if you want to write this data to a .txt you probably want to read it too, so I would advise you to plan how to write your variables, based on the language you want to use to read it (if you need to read it in python I would write them with file.write("%s;%d;%f;%f;%f; \n" % (sel.name, frame, degrees(rot.x), degrees(rot.y), degrees(rot.z))) so that you can use the split(";") function).
Also, it would be a good idea to write the object name only once before the first frame to save space