gpt4 book ai didi

python - “模块”对象没有属性 'unescape'

转载 作者:行者123 更新时间:2023-11-28 20:02:36 24 4
gpt4 key购买 nike

这段代码在控制台上运行完美,但是当我在我的 flask 应用程序中实现它时,它说有一个 AttributeError

        clean = html.unescape(tweet.text)

final = re.sub(r'\w+:\/{2}[\d\w-]+(\.[\d\w-]+)*(?:(?:\/[^\s/]*))*', '', clean)

我还尝试在 for 循环中 import html

from html import unescape

最佳答案

请注意 HTMLParser.unescape 自 3.9.0a1 版起已从 Python 中删除。

更新(应大众需求)

从 Python 3.4 开始,您可以使用 html.unescape,请参阅 https://docs.python.org/3/library/html.html

关于python - “模块”对象没有属性 'unescape',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45554339/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com