Python论坛  - 讨论区

标题:[python-chinese] 请问如何把cheetah模版中每一个可替换元素枚举出来?

2007年04月28日 星期六 09:44

ro rosettas在gmail.com
星期六 四月 28 09:44:34 HKT 2007

hi all

诸如这样一个模版
$title
$content


用指定元素名称的方式可以操作
from Cheetah.Template import Template
t = Template(file="mytemplate.tmpl")
t.title = "Greetings"
t.content = "Hello, world!"
print str(t)

但如果不确定元素名称,可以枚举出来吗

-- 
with kind regards

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年04月28日 星期六 20:43

L.J lujiacn在163.com
星期六 四月 28 20:43:22 HKT 2007

ro wrote:
> hi all
> 
> 诸如这样一个模版
> $title
> $content
> 
> 
> 用指定元素名称的方式可以操作
> from Cheetah.Template import Template
> t = Template(file="mytemplate.tmpl")
> t.title = "Greetings"
> t.content = "Hello, world!"
> print str(t)
> 
> 但如果不确定元素名称,可以枚举出来吗
> 
我也想知道


[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2025

    京ICP备05028076号