【发布时间】:2012-07-05 17:02:06
【问题描述】:
有没有办法使用 python 在 YAML 中存储和读取这个正则表达式:
regular: /<title [^>]*lang=("|')wo("|')>/
有人对此有任何想法或解决方案吗?
我有以下错误:
% ch.encode('utf-8'), self.get_mark())
yaml.scanner.ScannerError: while scanning for the next token
found character '|' that cannot start any token
in "test.yaml", line 10, column 49
我的代码:
def test2():
clueAppconf = open('test.yaml')
clueContext = yaml.load(clueAppconf)
print clueContext['webApp']
【问题讨论】:
-
你到底想做什么?将正则表达式存储在 yaml 中?从 yaml 中读取?使用它搜索 yaml 流?
-
那么,您是否有任何代码尝试执行此操作并且阻塞/失败?