Escape HTML

Escape HTML special characters to prevent XSS attacks and ensure safe rendering.

Code

Utilities
import html
return html.escape(str)

Parameters

The string containing HTML to escape.

Server

More Python Snippets