In Python I am trying to replace the codes '“' and '”' in the string using the replace txt file, I have read many tutorials but cannot come up with a solution. Any help would be greatly appreciated.
replace.txt “ " ” "
string = 'Biden Brags About Handing Out “Record” Number of Work Visas to Foreigners'
CodePudding user response:
Use html
library, it has a function to "convert" those character codes to utf-8.
import html
funny_str = "Test “"
print(html.unescape(funny_str))
CodePudding user response:
Use the replace method...
new_string = string.replace('“', '')
and
new_string = string.replace('≴', '')