HTML parsing bug?

Richard Brodie R.Brodie at
Mon Jan 30 15:59:00 CET 2006

<g_no_mail_please at> wrote in message 
news:1138632328.306349.241430 at

> Python 2.3.5 seems to choke when trying to parse html files, because it
> doesn't realize that what's inside <!--      --> is a comment in HTML,
> even if this comment is inside <script> </script>, especially if it's a
> comment inside that script code too.

Actually, you are technically incorrect;  try validating the code you posted.
Google found this explanation:
Feeding even slightly invalid HTML to the standard library parser will often
choke it. If you can't guarantee clean sources, best use Tidy first or another
parser entirely.

More information about the Python-list mailing list