【问题标题】:Get the contents of a specific attribute in span tag获取 span 标签中特定属性的内容
【发布时间】:2019-09-03 11:08:16
【问题描述】:

我有以下html:

<span class="price" itemprop="price" content="2349.00">
                2&nbsp;349&nbsp;KČ            </span>

我需要获取content属性(“2349.00”)的内容,scrapy可以做到吗?

我尝试了以下方法:

response.css('span.content').get()

但显然它不起作用....是否可以引用其他类似的属性作为类名并获取它们的内容??

【问题讨论】:

    标签: python web-scraping html-table scrapy


    【解决方案1】:

    试试:

    response.css('span::attr(content)').get()
    

    【讨论】:

      猜你喜欢
      • 2020-10-25
      • 1970-01-01
      • 1970-01-01
      • 2020-04-17
      • 1970-01-01
      • 2016-06-22
      • 1970-01-01
      • 2014-04-13
      • 1970-01-01
      相关资源
      最近更新 更多