Python reading from a file

Hello everyone,
I've been learning some python (I was using other commercial software before), and doing plots from data stored on files as X and Y pairs has not been an issue. Know, I have some files that look like this:

<Descriptive string>
<some "random" number>
<number of X values:nx>
<Number of Y values:ny>
X1 X2 X3 X4 X5
X6 X7 X8 X9 X10
...
... Xnx
Y1 Y2 Y3 Y4 Y5
Y6 Y7 Y8 Y9 Y10
...
... Yny
Z(X1,Y1) Z(X1,Y2) Z(X1,Y3) Z(X1,Y4) Z(X1,Y5)
Z(X1,Y6) Z(X1,Y7) Z(X1,Y8) Z(X1,Y9) Z(X1,Y10)
...
... 
Z(X1,Yny) Z(X2,Y1) Z(X2,Y3) Z(X2,Y4) Z(X2,Y5)
...
...
Z(X2,Yny) ...
...
...
Z(Xnx,Yny)

So, I have not been able to read properly through the X values and store them in a list, the Y values, store them in a list and finally the Z values and store them accordingly... at the end I want to create a contour plot... but I think that won't be the biggest problem once I understand how to read this values and store them. They are written in like this, using five columns, and there is a new line (not blank, just starts a new line) when it changes from X to Y to Z.
Thank you very much,