python的cheetah小例子

阅读更多
从python in a nutshell 中摘抄小例子.
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

你可能感兴趣的:(Python,OS,Socket,Java)