我想得到一本书的印章
timestamp_containers = page_soup.findAll("p", {"class":"tagline"})
输出为
<p class="tagline ">submitted <time class="live-timestamp" datetime="2018-10-06T10:02:28+00:00" title="Sat Oct 6 10:02:28 2018 UTC">1 month ago</time> by <a class="author may-blank id-t2_4r97b5o" href="https://old.reddit.com/user/Lord_Mop">Lord_Mop</a><span class="userattrs"></span><span class="gilding-bar" data-subredditpath="/r/assassinscreed/"></span></p>
我想要一个特定的元素" title="Sat Oct 6 10:02:28 2018 UTC"
但是当我尝试
for eeee in timestamp_containers[0].time:
if eeee == " title":
continue
print(eeee)
失败。如何在title
中获得timestamp_containers[0].time
?
答案 0 :(得分:0)
data = timestamp_containers[0].find('time').get('title')
看看下面我的输出,这是您需要的吗?
In [10]: print (data)
Sat Oct 6 10:02:28 2018 UTC