如何在 Google App Engine 上设置 PyParsing?
我在 Google App Engine 文档中看到 http://www.antlr.org/ Antlr3 用作解析第三方库。
但据我所知,Pyparsing 似乎更容易使用,我的目标只是解析一些简单的语法。
还有其他选择吗?我可以在 App Engine 上使用 pyparsing 吗?
I saw on the Google App Engine documentation that http://www.antlr.org/ Antlr3 is used as the parsing third party library.
But from what I know Pyparsing seems to be the easier to use and I am only aiming to parse some simple syntax.
Is there an alternative? Can I get pyparsing working on the App Engine?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为此目的,Pyparsing 的运行时占用空间特意较小。它是一个源文件 pyparsing.py,因此只需将其放入您自己的源文件中并解析即可!
——保罗
Pyparsing's runtime footprint is intentionally small for just this purpose. It is a single source file, pyparsing.py, so just drop it in amongst your own source files and parse away!
-- Paul
“就这样做”!-)获取 pyparsing.py,例如来自 此处,并将其放入您的应用引擎应用的目录中;现在您只需在应用代码中导入 pyparsing 并使用它即可。
例如,将此处中的greeting.py调整为:
添加到您的app.yaml 位于
handlers:
下的两行:启动您的应用程序,访问
http://localhost:8083/parshello
(或您正在运行的任何端口;- ),您将在浏览器中看到纯文本输出:"Just do it"!-) Get pyparsing.py, e.g. from here, and put it in your app engine app's directory; now you can just
import pyparsing
in your app code and use it.For example, tweak the greeting.py from here to be:
add to your app.yaml right under
handlers:
the two lines:start your app, visit
http://localhost:8083/parshello
(or whatever port you're running on;-), and you'll see in your browser the plain text output: