Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

html.unescape() in Python

  • Last Updated : 22 Apr, 2020

With the help of html.unescape() method, we can convert the ascii string into html script by replacing ascii characters with special characters by using html.escape() method.

Syntax : html.unescape(String)

Return : Return a html script.

Example #1 :
In this example we can see that by using html.unescape() method, we are able to convert the ascii string into html script by using this method.




# import html
import html
  
s = '<html><head></head><body><h1>This is python</h1></body></html>'
temp = html.escape(s)
# Using html.unescape() method
gfg = html.unescape(temp)
  
print(gfg)

Output :

This is python

Example #2 :




# import html
import html
  
s = '<html><head></head><body><h1>GeeksForGeeks</h1></body></html>'
temp = html.escape(s)
# Using html.unescape() method
gfg = html.unescape(temp)
  
print(gfg)

Output :

GeeksForGeeks

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!