I need to parse some text and integers from a file
<p>I'm having trouble with a problem I'm trying to do. My goal is to import a file that contains football teams names, and then the number of wins and losses, and then if a team's average is greater than .500, than I have to write that teams name, and average to a new file. And then I have to write the teams under .500 to a seperate file. so far I have my code so that it reads eachline of the file, but I can't figure out how to analyize each line of code. I'm really just looking for any advice I could get at this point, and it would be greatly appreciated.</p>

<pre><code>scores = open("fbscores.txt",'r')
eachline = scores.readline()
while eachline != "":
    print(eachline)
    eachline = scores.readline()
scores.close()
</code></pre>

<p>It's really helpful if you post some lines from your input. 
According to your description, I assuming each line in your input has the following layout:</p>

<pre><code>[NAME] X Y
</code></pre>

<p>Where, <code>NAME</code> is the team name, <code>X</code> is the number of wins, <code>Y</code>, the number of loses.
You can simply split the line by any delimiter (which is 'space' in this example case), </p>

<pre><code>eachline = eachline.split()
</code></pre>

<p>If there was a comma separator, then you do <code>eachline = eachline.split(',')</code> and so on, you get the idea.</p>

<p>Then eachline will store a list of the following structure <code>['NAME', X, Y]</code>
Then you can access <code>X</code> and <code>Y</code> to average them using: <code>eachline[0]</code> and <code>eachline[1]</code> respectively.</p>

python