fork download
  1. import html
  2.  
  3. myHtml = "<body><h1> How to use html.unescape() in Python </h1></body>"
  4. encodedHtml = html.escape(myHtml)
  5. print("Encoded HTML: ", encodedHtml)
  6. decodedHtml = html.unescape(encodedHtml)
  7.  
  8. print("Decoded HTML: ", decodedHtml)
Success #stdin #stdout 0.03s 10300KB
stdin
Standard input is empty
stdout
Encoded HTML:  &lt;body&gt;&lt;h1&gt; How to use html.unescape() in Python &lt;/h1&gt;&lt;/body&gt;
Decoded HTML:  <body><h1> How to use html.unescape() in Python </h1></body>