Beautiful Soup:如何从此结构中提取文本:

问题描述 投票:0回答:1

我想访问title = ""中的时间戳记文本>

并获得此字符串“ 23.12.2019 13:05:24

[<div class="pull_right date details" title="23.12.2019 13:05:24">
 13:05
        </div>]

我已经知道要在此div中访问适当的文本。但这只是一个小时。我需要完整的时间戳。

我当前正在使用此结构:

ltimestamp = []
for tag in divTag:
    tdTags = tag.find_all("div", {"class": "pull_right date details"})    
for tag in tdTags:
    ltimestamp.append(tag.text)

我想访问title =“中的时间戳文本,并获取此字符串” 23.12.2019 13:05:24“ [

13:05
python web-scraping beautifulsoup text-mining
1个回答
0
投票
当您拥有此元素时<div class="pull_right date details" title="23.12.2019 13:05:24">13:05</div>
© www.soinside.com 2019 - 2024. All rights reserved.