如何使用BeautifulSoup根据前一个元素获取没有id或类的<p>标记的内容?

时间:2017-06-08 01:48:20

标签: python beautifulsoup

我正在使用BeautifulSoup来删除网页。

我正在尝试获取没有id或类的p标记的内容,但前面是带有不同类的span:

<p> uninteresting content here...</p>
<span class="description">DESCRIPTION:</span>
<p>Hi ! This is the content which I am interested in.</p>
<p> another uninteresting content to be discarded.</p>

那么,我如何根据span class =&#34;描述&#34;来获取p内容。它来到它之前?

提前感谢,

1 个答案:

答案 0 :(得分:1)

client$ git clone --depth 1 git@host:/opt/git/project.git
Cloning into 'project'...
remote: Counting objects: 575, done.
remote: error: inflate: data stream error (invalid distance code)
remote: error: corrupt loose object 'b197fe2367c199e8b45d86cd62ba00446888bc58'
remote: fatal: loose object b197fe2367c199e8b45d86cd62ba00446888bc58 (stored in objects/b1/97fe2367c199e8b45d86cd62ba00446888bc58) is corrupt
error: git upload-pack: git-pack-objects died with error.
fatal: git upload-pack: aborting due to possible repository corruption on the remote side.
remote: aborting due to possible repository corruption on the remote side.
fatal: early EOF