欢迎大家赞助一杯啤酒🍺 我们准备了下酒菜:Formal mathematics/Isabelle/ML, Formal verification/Coq/ACL2/Agda, C++/Lisp/Haskell
CheetahTemplate
来自开放百科 - 灰狐
(版本间的差异)
小 (→User) |
|||
| (未显示1个用户的9个中间版本) | |||
| 第1行: | 第1行: | ||
| + | {{top news}} | ||
| + | {{SeeWikipedia}} | ||
| + | |||
Cheetah - The Python-Powered Template Engine | Cheetah - The Python-Powered Template Engine | ||
http://www.cheetahtemplate.org | http://www.cheetahtemplate.org | ||
| + | |||
| + | ==Quickstart== | ||
| + | Debian用户 | ||
| + | apt-get install python2.3-cheetah | ||
| + | apt-get install python2.4-cheetah | ||
| + | Cheetah 被安装到 /usr/lib/python2.4/site-packages/Cheetah | ||
| + | 其他用户 | ||
| + | python setup.py install | ||
| + | /usr/local/Python2.5/lib/site-packages/Cheetah | ||
| + | or | ||
| + | C:\Python25\Lib\site-packages\Cheetah | ||
| + | |||
| + | >>> from Cheetah.Template import Template | ||
| + | >>> templateDef = """ | ||
| + | ... <HTML> | ||
| + | ... <HEAD><TITLE>$title</TITLE></HEAD> | ||
| + | ... <BODY> | ||
| + | ... $contents | ||
| + | ... ## this is a single-line Cheetah comment and won't appear in the output | ||
| + | ... #* This is a multi-line comment and won't appear in the output | ||
| + | ... blah, blah, blah | ||
| + | ... *# | ||
| + | ... </BODY> | ||
| + | ... </HTML>""" | ||
| + | >>> nameSpace = {'title': 'Hello World Example', 'contents': 'Hello World!'} | ||
| + | >>> t = Template(templateDef, searchList=[nameSpace]) | ||
| + | >>> print t | ||
| + | |||
| + | >>> nameSpace['title'] = 'Huihoo' | ||
| + | >>> print t | ||
==User== | ==User== | ||
| − | *http://reddit.com | + | *http://reddit.com/ |
| + | *http://klive.cpushare.com/ - KLive: Linux Kernel Live Usage Monitor | ||
| + | *[[Snurf Python-based Blog|Snurf]] | ||
| + | *[[PyBlosxom]] | ||
| + | *http://linuxgazette.net/ | ||
| + | |||
| + | {{comment}} | ||
| + | |||
| + | [[Category:Template]] | ||
| + | [[Category:Python]] | ||
2010年12月1日 (三) 00:27的最后版本
| |
您可以在Wikipedia上了解到此条目的英文信息 CheetahTemplate Thanks, Wikipedia. |
Cheetah - The Python-Powered Template Engine
http://www.cheetahtemplate.org
[编辑] Quickstart
Debian用户
apt-get install python2.3-cheetah apt-get install python2.4-cheetah Cheetah 被安装到 /usr/lib/python2.4/site-packages/Cheetah
其他用户
python setup.py install /usr/local/Python2.5/lib/site-packages/Cheetah or C:\Python25\Lib\site-packages\Cheetah
>>> from Cheetah.Template import Template
>>> templateDef = """
... <HTML>
... <HEAD><TITLE>$title</TITLE></HEAD>
... <BODY>
... $contents
... ## this is a single-line Cheetah comment and won't appear in the output
... #* This is a multi-line comment and won't appear in the output
... blah, blah, blah
... *#
... </BODY>
... </HTML>"""
>>> nameSpace = {'title': 'Hello World Example', 'contents': 'Hello World!'}
>>> t = Template(templateDef, searchList=[nameSpace])
>>> print t
>>> nameSpace['title'] = 'Huihoo' >>> print t
[编辑] User
- http://reddit.com/
- http://klive.cpushare.com/ - KLive: Linux Kernel Live Usage Monitor
- Snurf
- PyBlosxom
- http://linuxgazette.net/
<discussion>characters_max=300</discussion>
分享您的观点