html — 하이퍼텍스트 마크업 언어 지원

소스 코드: Lib/html/__init__.py


이 모듈은 HTML을 조작하는 유틸리티를 정의합니다.

html.escape(s, quote=True)

Convert the characters &, < and > in string s to HTML-safe sequences. Use this if you need to display text that might contain such characters in HTML. If the optional flag quote is true (the default), the characters (") and (') are also translated; this helps for inclusion in an HTML attribute value delimited by quotes, as in <a href="...">. If quote is set to false, the characters (") and (') are not translated.

Added in version 3.2.

html.unescape(s)

문자열 s의 모든 이름과 숫자 문자 참조(예를 들어, &gt;, &#62;, &#x3e;)를 해당 유니코드 문자로 변환합니다. 이 함수는 유효하거나 유효하지 않은 문자 참조 모두에 대해 HTML 5 표준에 정의된 규칙과 HTML 5 이름 문자 참조 목록을 사용합니다.

Added in version 3.4.


html 패키지의 서브 모듈은 다음과 같습니다:

  • html.parser – 관대한 구문 분석 모드가 있는 HTML/XHTML 구문 분석기

  • html.entities – HTML 엔티티 정의