从两个随之而来的span标签中提取文本并使用beautifulsoup

时间:2019-10-31 22:07:19

标签: python beautifulsoup

我想一起从两个随后的span标签中提取文本值。


<span class="research-details-footer-key">Bathrooms:</span>, <span>1</span>

1 个答案:

答案 0 :(得分:-2)

import re

pat = re.compile('>([\w:]*)<')
value = '<span class="research-details-footer-key">Bathrooms:</span>, <span>1</span>'

print(pat.findall(value))

output : ['Bathrooms:', '1']