Sunday, June 14, 2026
HomeLanguageshtml.unescape() in python

html.unescape() in python

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.

html.unescape() Python Example

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.

Python3




# 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

Another Example of html.unescape() python

Python3




# 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

Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32515 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
6897 POSTS0 COMMENTS
Nicole Veronica
12013 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12109 POSTS0 COMMENTS
Shaida Kate Naidoo
7019 POSTS0 COMMENTS
Ted Musemwa
7262 POSTS0 COMMENTS
Thapelo Manthata
6976 POSTS0 COMMENTS
Umr Jansen
6964 POSTS0 COMMENTS