【发布时间】:2014-08-04 21:39:52
【问题描述】:
我在 Windows Vista 64 位上使用 Python.org 版本 2.7 64 位。我正在使用带有 Scrapy 的正则表达式来解析以下页面中名为“Datastore.prime”的第一个 Javascript 项中包含的数据:
Link here 我使用的正则表达式是这样的:
regex = re.compile('DataStore\.prime\(\'standings\', { stageId: \d+ }.*')
match2 = re.findall(regex, response.body, re.S)
match3 = str(match2)
match3 = match3.replace('<a class="w h"', '').replace('<a class="w a"', '').replace('<a class="d h"', '') \
.replace('<a class="d a"', '').replace('<a class="l h"', '').replace('<a class="l a"', '') \
.replace('title=', '')
print match3
但是,这会在这篇文章的标题中抛出错误:
raise ValueError('Cannot process flags argument with a compiled pattern')
exceptions.ValueError: Cannot process flags argument with a compiled pattern
谁能看出问题出在哪里?
谢谢
【问题讨论】: