📜  Python中的html.unescape()

📅  最后修改于: 2022-05-13 01:55:01.297000             🧑  作者: Mango

Python中的html.unescape()

借助html.unescape()方法,我们可以通过使用html.escape()方法将 ascii字符替换为特殊字符,将 ascii字符串转换为 html 脚本。

示例 #1:
在这个例子中我们可以看到,通过使用html.unescape()方法,我们可以使用该方法将 ascii字符串转换为 html 脚本。

# import html
import html
  
s = '

This is python

' temp = html.escape(s) # Using html.unescape() method gfg = html.unescape(temp)    print(gfg)

输出 :

示例 #2:

# import html
import html
  
s = '

GeeksForGeeks

' temp = html.escape(s) # Using html.unescape() method gfg = html.unescape(temp)    print(gfg)

输出 :