I have this file:
<table>
<tr>
<td WIDTH="49%">
<p><a href="...1.htm"> cell to remove</a></p></td>
<td WIDTH="51%"> some text </td>
</tr>
I need as result this:
<table>
<tr>
<td>
</td>
<td WIDTH="51%"> some text </td>
</tr>
I am trying to read the file with this html and replace my first tag with an empty one:
ret = open('rec1.txt').read()
re.sub('<td[^/td>]+>','<td> </td>',ret, 1)
final= open('rec2.txt', 'w')
final.write(ret)
final.close()
As you can see i am new using python and something, when i read rec2.txt it contains exactly the same text of the previous file.
tks