我正在使用python3.6.3处理Goodreads页面中的以下HTML片段:
<div class="quoteText">
“Don't cry because it's over, smile because it happened.”
<br/> ―
<a class="authorOrTitle" href="/author/show/61105.Dr_Seuss">Dr. Seuss</a>
</div>, <div class="quoteText">
我使用beauthoulsoup来获取HTML并仅隔离上面片段中的“quoteText”类。现在,我想将引号和作者名保存为单独的字符串。我可以用
^{pr2}$我不知道该怎么做。我想我需要一种从输出中删除子类的方法,并尝试使用extract方法。在
quote.extract(class_="authorOrTitle")
但我有一个错误,说extract得到了一个意外的关键字参数'class' 我想做的事还有别的办法吗?在
这是我第一次在这里发帖,所以如果帖子不符合特殊性/格式/其他标准,我深表歉意。在
相关问题 更多 >
编程相关推荐