pyparsing问题
|
现在,我刚刚开始使用ѭ0来解析简单的后缀表达式。此刻,我到了:
from pyparsing import *
integer = Word(nums)
op = Word(\"+-*/^\", max=1)
space = Word(\" \")
expr = Word(nums)+space+Word(nums)+space+op
parsed = expr.parseString(\"3 4 *\")
print parsed
但是当我运行它时,它会打印:
Traceback (most recent call last):
File \"star_parse.py\", line 6, in <module>
parsed = expr.parseString(\"3 4 *\")
File \"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pyparsing-1.5.5-py2.6.egg/pyparsing.py\", line 1100, in parseString
raise exc
pyparsing.ParseException: Expected W:( ) (at char 2), (line:1, col:3)
我究竟做错了什么?
没有找到相关结果
已邀请:
2 个回复
厘恼轨
:
粳饶瓢部
http://packages.python.org/pyparsing/pyparsing.pyparsing.White-class.html