html
Stdlib — NetworkingPython 2.0+Advanced
HTML entity escaping and unescaping
Quick Info
- Documentation
- Official Docs
- Python Version
- 2.0+
- Dependencies
- None — Python Standard Library
- Install
Included with Python
Learn by Difficulty
Quick Example
python
import html # Escape HTML text = '<script>alert("XSS")</script>' safe = html.escape(text) print(f"Escaped: {safe}") # Unescape print(f"Unescaped: {html.unescape(safe)}")
The html module is part of Python's standard library. HTML entity escaping and unescaping.
Try in PlaygroundTags
stdlibnetworkinginternet