Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-82665 Mention that HTMLParser.handle_starttag value can be None#134312

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
Fearless-Badger wants to merge2 commits intopython:main
base:main
Choose a base branch
Loading
fromFearless-Badger:main
Open
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletionDoc/library/html.parser.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -134,7 +134,8 @@ implementations do nothing (except for :meth:`~HTMLParser.handle_startendtag`):
argument is a list of ``(name, value)`` pairs containing the attributes found
inside the tag's ``<>`` brackets. The *name* will be translated to lower case,
and quotes in the *value* have been removed, and character and entity references
have been replaced.
have been replaced. If a boolean attribute is encountered, the *value* for the
``(name, value)`` attribute pair will be ``None``.

For instance, for the tag ``<A HREF="https://www.cwi.nl/">``, this method
would be called as ``handle_starttag('a', [('href', 'https://www.cwi.nl/')])``.
Expand DownExpand Up@@ -310,6 +311,16 @@ further parsing:
Data : alert("<strong>hello!</strong>");
End tag : script

Boolean attributes have a *value* of ``None``:

.. doctest::

>>> parser.feed("<script src='/script.js' defer></script>")
Start tag: script
attr: ('src', '/script.js')
attr: ('defer', None)
End tag : script

Parsing comments:

.. doctest::
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp