我有以下字符串,我想使用css选择器忽略字符串中的强标记:
<p><strong>Local:</strong><br>
-Brasília/DF </p>
Run Code Online (Sandbox Code Playgroud)
我尝试了以下语法,但它不起作用.
p:not(strong)
Run Code Online (Sandbox Code Playgroud)
我哪里错了?
我是scrapy的新手,我正在使用Scrapy 0.14.4.我只想按照以下示例打印标题和链接.
这是我的蜘蛛:
from scrapy.spider import BaseSpider
class XxxSpider(BaseSpider):
name = "xxx"
allow_domains = ["xxx.xxx.xxx"]
start_urls = ["http://xxx.xxx.com/jobs/"]
def parse(self, response):
for sel in response.xpath("//div[@id='job_listings']/a"):
title = sel.xpath('./text()').extract()
link = sel.xpath('./@href').extract()
print title, link
Run Code Online (Sandbox Code Playgroud)
这有什么缺失?
这个问题仅适用于python:
我有一个俄语字符串中的城市名称,其格式为Unicode,如:
\u041C\u043E\u0441\u043A\u0432\u0430
手段
??????
如何获取原始文本而不是unicode字符?
注意:请勿使用任何导入模块