Skip to content
Advertisement

How to Ignore html comment tag in regex through python

I am replacing special character with some asci code and ignoring html tags with the help of below regex

text_list = re.findall(r'>([Ss]*?)<', html)

So it is ignoring all html tags as we want it but is not ignoring html comment closing tag “–>”.

Any help appreciated. What should I changed in regex.

Attached screenshot for your reference.here in second screen you could see acsi code replaced

Advertisement

Answer

Please try whil read the file please pass the multiple encoding parameters

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement