-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
html.parser produces different output than documented #131535
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi! This is the expected behavior. You need to set >>> parser = MyHTMLParser(convert_charrefs=False)
>>> parser.feed('>>>')
Named ent: >
Num ent : >
Num ent : > From the docs:
|
Thank you, I understand now. However, the example code at the bottom of this documentation page does not explicitly set convert_charrefs=False, yet it still produces results as if convert_charrefs were True. This has confused me. Would it be better to refine this example for clarity? |
Ah, in that case I agree the example should be clarified. It looks like it wasn't updated when the default for It would be good to migrate the examples to |
… doctests (pythonGH-131551) (cherry picked from commit ee76e36) Co-authored-by: Brian Schubert <[email protected]>
…xamples doctests (pythonGH-131551) (cherry picked from commit ee76e36) Co-authored-by: Brian Schubert <[email protected]>
…s doctests (GH-131551) (GH-133587) (cherry picked from commit ee76e36) Co-authored-by: Brian Schubert <[email protected]>
When parsing >>> using html.parser, the actual output differs from the expected behavior as documented.
Run the following code:
According to the documentation, the expected output should be:
The actual output is:
Linked PRs
html.parser
docs, make examples doctests #131551The text was updated successfully, but these errors were encountered: