Set keyframe dynamically(Read data/input from file)

I’m currently using Blender version 2.6.
I’m just a beginner that learnt Python 3 and Blender for around 1/2 week based on online tutorial and also youtube video. I found most of them are really basic and foundation tutorial. I’m now wondering how powerful can python works in Blender.

I’m doing a school project now. I need to create a 3D human model that playing soccer tricks. I already able to make it move by using setting the keyframe.
For the character part, I’m using Makehuman to export to Blender by using Collada importer. I’m not probably not a designer, but a IT student. So, I unable to draw the character myself, just import from software.

Now further in my project, my lecturer ask me to let the human model play the soccer tricks dynamically, by reading data/location from input text file. Is it Python in Blender manage to do this?
I do not need any help on the full code. I just need some guides and clarification that really can help me to ensure that Python and Blender manage to do this.

Example output and process of the project will be something like this:
In the text file, 1st line will be the speed of the player: 2m/s
2nd line will be the force act on the soccer ball: 40N

Then inside the Blender Python script, it need to read data from this text file and add in some formula to set the keyframe for this. Is it possible to do this?
Any sample tutorial or some guidelines that can guide me along this project?

Not sure if this is what your looking for, but you could use the file.readlines() module.

file = open("path	o\file", 'w')
a = file.readlines()
print(a)

Tom

please DONT do this without reading the python-Tutorials (or docs),
this sample will not read any lines from the file, because the used
mode “w” will delete the file with its contents - thus creating an empty
file with this name and from an empty file no “lines” can be read …
This is nothing else than to delete the contents of those files or
if they dont exist, it creates a new empty file with this name.

Sorry, my bad, tha should have been “r”, not “w”. Here’s a link to a good introduction to Python I/O:

http://www.sthurlow.com/python/lesson10/

Thanks
Tom