This code works perfectly on the console but when I implement it in my flask application it says that there's an AttributeError
clean = html.unescape(tweet.text)
final = re.sub(r'\w+:\/{2}[\d\w-]+(\.[\d\w-]+)*(?:(?:\/[^\s/]*))*', '', clean)
I also tried import html
inside the for loop
and from html import unescape
Please note that HTMLParser.unescape
was removed from Python since version 3.9.0a1.
Update (due to popular demand)
Beginning with Python 3.4 you can use html.unescape
, see https://docs.python.org/3/library/html.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With