【发布时间】:2014-11-01 23:41:52
【问题描述】:
我有以下 bs4 对象列表:
>>> listing
<div class="listingHeader">
<h2>
....
>>> type(listing)
<class 'bs4.element.Tag'>
我想将原始 html 提取为字符串。我试过了:
>>> a = listing.contents
>>> type(a)
<type 'list'>
所以这不起作用。我该怎么做?
【问题讨论】:
标签: python html beautifulsoup html-parsing