非基于网络的模板系统 [英] Non-web-based templating system
问题描述
我正在用Python创建一个小应用程序,它使用列表和
字典来创建一个基本的数据库。我想创建一些
填空 从这些数据报告,理想情况下,将RTF
或纯文本文件作为模板,并用我的
数据替换占位符标签。
是否有任何好的预先编写的系统都可以让我这样做吗?
谢谢,
- QS计算。
Hi,
I''m creating a small application in Python that uses lists and
dictionaries to create a rudimentary database. I''d like to create some
"fill-in-the-blanks" reports from this data, ideally by taking an RTF
or plaintext file as a template and replacing placeholder tags with my
data.
Are there any good pre-written systems that would allow me to do this?
Thanks,
- QS Computing.
推荐答案
qs ********* @ gmail .com 写道:
qs*********@gmail.com wrote:
我正在用Python创建一个使用列表和
词典的小应用程序创建一个基本的数据库。我想创建一些
fill-in-the-blanks。从这些数据中获取报告,理想情况是将RTF
或纯文本文件作为模板,并用我的
数据替换占位符标签。
是否有任何好的预先编写的系统可以让我做这个?
Hi,
I''m creating a small application in Python that uses lists and
dictionaries to create a rudimentary database. I''d like to create some
"fill-in-the-blanks" reports from this data, ideally by taking an RTF
or plaintext file as a template and replacing placeholder tags with my
data.
Are there any good pre-written systems that would allow me to do this?
也许内置的字符串插值就足够了?
print" Hello%(name)s" %dict(name =" Peter Pan")
diez
Maybe the built-in string interpolation is sufficient?
print "Hello %(name)s" % dict(name="Peter Pan")
diez
Diez B. Roggisch写道:
Diez B. Roggisch wrote:
< a href =mailto:qs ********* @ gmail.com> qs ********* @ gmail.com 写道:
qs*********@gmail.com wrote:
我正在用Python创建一个小应用程序,它使用列表和
词典来创建一个基本的数据库。我想创建一些
fill-in-the-blanks。从这些数据中获取报告,理想情况是将RTF
或纯文本文件作为模板,并用我的
数据替换占位符标签。
是否有任何好的预先编写的系统可以让我做这个?
Hi,
I''m creating a small application in Python that uses lists and
dictionaries to create a rudimentary database. I''d like to create some
"fill-in-the-blanks" reports from this data, ideally by taking an RTF
or plaintext file as a template and replacing placeholder tags with my
data.
Are there any good pre-written systems that would allow me to do this?
也许内置的字符串插值就足够了?
print" Hello%(name)s" %dict(name =" Peter Pan")
Maybe the built-in string interpolation is sufficient?
print "Hello %(name)s" % dict(name="Peter Pan")
否则你可能想看看:
- http://www.python.org/doc/2.4.2/whatsnew/ node5.html
- empy: http ://www.alcyone.com/pyos/empy/
- 猎豹: http://www.cheetahtemplate.org/
HTH
-
bruno desthuilliers
python -c" print''@''。join([''。''。join([w [:: - 1] for p in p.split('' 。'')])
p in''o **** @ xiludom.gro''。split(''@'')])"
Else you may want to look at:
- http://www.python.org/doc/2.4.2/whatsnew/node5.html
- empy : http://www.alcyone.com/pyos/empy/
- cheetah : http://www.cheetahtemplate.org/
HTH
--
bruno desthuilliers
python -c "print ''@''.join([''.''.join([w[::-1] for w in p.split(''.'')]) for
p in ''o****@xiludom.gro''.split(''@'')])"
谢谢,看起来就像我需要的那样。
Thanks, it looks like empy is what I need.
这篇关于非基于网络的模板系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!