[Solved] How do I stop extracting href tags using Beautifulsoup when I encounter a comment in html?


In HTML, XHTML, XML, the <!-- starts a commentary scope and --> finish it. It is a comment and it does not affect the result on the browser, but add some bytes on the response.

<!-- comment some text 
     and you can break lines.
     It is compatible for html, xhtml and xml.
-->

On other languages you have other sintaxes for comments, for sample:

/* this is a comment for C, C++, C#, Java, Javascript, CSS, etc.
   you can break lines */

// this is a single line comment for C, C++, C#, Java, Javascript.. you can't break lines here

See more about comments if you want on this link.

solved How do I stop extracting href tags using Beautifulsoup when I encounter a comment in html?