Python 使用Beautiful soup提取特定数据(HTML utime)

Python 使用Beautiful soup提取特定数据(HTML utime),python,beautifulsoup,Python,Beautifulsoup,我需要从以下行导出数据utime: <abbr title="23/1/20, 10:52 &#x3c0;.&#x3bc;." data-utime="1579805539" data-shorten="1" class="_5ptz"> 我该怎么做?使用soup.find()玩了一段时间,但没有找到解决方案。您可以执行find操作,然后执行get操作以获得属性值 像这样: utime = soup.find('abbr', {'class': '_5ptz'}

我需要从以下行导出数据utime:

<abbr title="23/1/20, 10:52 &#x3c0;.&#x3bc;." data-utime="1579805539" data-shorten="1" class="_5ptz">


我该怎么做?使用
soup.find()
玩了一段时间,但没有找到解决方案。

您可以执行
find
操作,然后执行
get
操作以获得属性值

像这样:

utime = soup.find('abbr', {'class': '_5ptz'}).get('data-utime')

我获取
AttributeError:“非类型”对象在尝试时没有属性“获取”
。您网站的url是什么?您遇到的错误meens soup没有找到
abbr
标记。它可以由JavaScription加载这是否回答了您的问题?如果你的url是公共的,你可以共享它。