html.unescape() in python
Last Updated :
12 Sep, 2023
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
s = '<html><head></head><body><h1>This is python</h1></body></html>'
temp = html.escape(s)
gfg = html.unescape(temp)
print (gfg)
|
Output :
This is python
Another Example of html.unescape() python
Python3
import html
s = '<html><head></head><body><h1>GeeksForGeeks</h1></body></html>'
temp = html.escape(s)
gfg = html.unescape(temp)
print (gfg)
|
Output :
GeeksForGeeks
Share your thoughts in the comments
Please Login to comment...