How can I do this with python?

I have an animatipn that is about 75 frames long. What I want to do is get the LocZ for every single frame, and have it print either to the DOS prompt looking thing, or, even better, to a printer. Could I make it so it prints the framenumber - 26 and then the LocZ for the frame, maybe even on the same line.
Any help is appreciated.

import Blender
obj = Blender.Object.Get("Plane")
print Blender.Get('curframe'), obj.LocZ

I just started programming in Python not too long ago, so I’m a little unsure… but I think the above will work. If you add it to the scripts buttons under “framechanged” This will output the frame number and the LocZ to the dos window. You will need to change the “Plane” in line 2 to whatever object you wanna get the LocZ from. I bet there is someone here that knows how to send this data to a text file for printing… but I don’t.

I figured it out and that’s basically what I did but I didn’t print the frame.