So, this is driving me nuts. How can I convert encoded characters like %apos to plaintext? Using Python 3.9.
What I Tried:
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)
CodePudding user response:
This has nothing to do with Unicode. It's HTML.
import html
print(html.unescape('''))
CodePudding user response:
You're looking for html.unescape()
https://docs.python.org/3/library/html.html#html.unescape
>>> html.unescape("'Russia's Newsroom'")
"'Russia's Newsroom'"
