Python: loop through a file for specific lines
<p>I have the following lines in a file where I want to take the third column; In the file I don't have the numbers column:</p>

<ol>
<li>Red; Blue; Green; White; Orange;</li>
<li>Green; White; Orange;</li>
<li>Blue; Green; White;</li>
<li>Red; Blue; Green; White;</li>
<li>Blue; Green; White; Orange;</li>
<li>Orange</li>
<li>Green; White; Orange;</li>
<li>White; Orange</li>
<li>Green;</li>
</ol>

<p>I used this code line to do that:</p>

<pre><code>lines = i.split(";")[2]
</code></pre>

<p>The problem is that some of the lines have only one column or two, so it gives me 'index out of range' error. Please tell me how to go about this problem?</p>

<p>thanks a lot
Adia</p>
