【问题标题】:Text extract from two consequent span tags with beautifulsoup用beautifulsoup从两个后续的span标签中提取文本
【发布时间】:2019-10-31 22:07:19
【问题描述】:

我想从两个连续的 span 标签中提取文本值。


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

【问题讨论】:

标签: python beautifulsoup


【解决方案1】:
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']

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-07-26
  • 1970-01-01
  • 2023-04-02
  • 2021-07-15
  • 1970-01-01
相关资源
最近更新 更多