删除特定HTML标签我有一个HTML细胞内的一些HTML表格,就像这样:与蟒蛇
miniTable='<table style="width: 100%%" bgcolor="%s">
<tr><td><font color="%s"><b>%s</b></td></tr>
</table>' % (bgcolor, fontColor, floatNumber)
html += '<td>' + miniTable + '</td>'
有没有办法去除,涉及到这个minitable HTML标记,并只有这些html标签?
我想以某种方式删除这些标签:
<table style="width: 100%%" bgcolor="%s"><tr><td><font color="%s"><b>
and
</b></td></tr></table>
得到这个:
floatNumber
其中floatNumber
是一个浮点数的字符串表示。 我不希望任何其他HTML标记以任何方式进行修改。我想使用string.replace或正则表达式,但我很难过。
对于我的应用程序,这个工程太棒了!如果我可以使用美丽的汤,奥托的解决方案也很棒 – jh314 2012-07-13 15:22:29