June 1, 2006
从这里看来的。print 竟然可以这样玩!
dict = {\"name\": \"Guido\"}
print \"Hello %(name)s!\" % dict
可以注意到, %(name)s 中,name 是 dict 的 key,而 s 则是 format string。
读过 OSCON 2005 Effective Python Programming slides 之后,我看到刚才链接里的文章把 Python 的 Template 模式玩到了新的高度,令人咋舌不已。感叹道:
Python,你真是太邪门了!
The URI to TrackBack this entry is: http://tchaikov.blogsome.com/2006/06/01/p28/trackback/
RSS feed for comments on this post.
Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>
长见识了
Comment by manman — January 28, 2007 @ 12:48 pm