将 &apos 等字符解码为明文

Decode chars like &apos into plaintext

所以,这让我抓狂。如何将 %apos 等编码字符转换为明文?使用 Python 3.9.

我尝试了什么:

string = 'The guy blasts the other guy on 'Russia's Newsroom': 'Totally unfit' to be vice chancellor'

new_string = string.encode('utf-8', 'ignore')

print(new_string)

这与 Unicode 无关。这是 HTML。

import html
print(html.unescape('''))

您正在寻找 html.unescape()

https://docs.python.org/3/library/html.html#html.unescape

>>> html.unescape("'Russia's Newsroom'")
"'Russia's Newsroom'"