Given table:
table='''<table> <tr> <td>Num of something 1</td> <td>4532</td> <td>78</td> </tr> <tr> <td>Num of something 2</td> <td>0</td> <td>235</td> </tr> <tr> <td>Num of something 3</td> <td>8</td> <td>6589</td> </tr> </table>''' if root.xpath('.//td[text()="'+string_parameter+'"]'): result = item.xpath('//td[position()=3]') You need to do this: if Num of something 3 is found, then output 6589