Python How to convert html text to csv? : I have this following HTML table in a text file (.txt), I want to convert it to the following format. Any help is appreciated.

    <td class="det" colspan="1" width="40%">Basic EPS (Rs.)</td>
    <td align="right" class="det">57.18</td>
    <td align="right" class="det">48.84</td>
    </tr>
    <tr height="22px">
    <td class="det" colspan="1" width="40%">Diluted Eps (Rs.)</td>
    <td align="right" class="det">56.43</td>
    <td align="right" class="det">48.26</td>
    </tr> 

the csv output should look something like this...

    Basic EPS (Rs.)|57.18|48.84
    Diluted Eps (Rs.)|56.43|48.26

Regards, babsdoc