擅长:python、mysql、java
<p>如果您想将<code>About the author</code>与不在段落中的内容一起踢出,可以通过在类<code>td-post-content</code>内打印<code>p</code>标记下的<code>span</code>标记的内容来完成。为了简洁起见,我在本例中使用选择器。也试试下面的方法。在</p>
<pre><code>import requests
from bs4 import BeautifulSoup
url = 'https://www.the-blockchain.com/2018/06/29/mcafee-labs-report-6x-increase-in-crypto-mining-malware-incidents-in-q1-2018/'
res = requests.get(url,headers={"User-Agent":"defined"})
soup = BeautifulSoup(res.text, 'lxml')
paragraph = [p.text for p in soup.select('.td-post-content p span')]
print(paragraph)
</code></pre>