python的cheetah小例子
从python in a nutshell 中摘抄小例子. [code="java"] import Cheetah.Template import os, time, socket tt = Cheetah.Template.Template(''' Report by $USER
Report on host data
Report written at $asctime:
#for $hostline in $uname $hostline
#end for
''', searchList=[time, os.environ]) try: tt.uname = os.uname except AttributeError: tt.uname = [socket.gethostname( )] print tt [/code]