HTML:
<html>
<head>
<base href='http://example.com/' />
<title>Example website</title>
</head>
<body>
<div id='demo'>
<div>水果:苹果 运动:足球 语言:中文</div>
</div>
</body>
</html>
我想得到这样的结果:
>>> response.xpath('//div[@id="demo"]/div/text()').re(r'')
u'苹果'
>>> response.xpath('//div[@id="demo"]/div/text()').re(r'')
u'足球'
>>> response.xpath('//div[@id="demo"]/div/text()').re(r'')
u'中文'
问题:
上面re(r'')
中的正则表达式该怎么写?
MYYA
相关分类