Python 模板引擎 Mako

码农软件 · 软件分类 · 模板引擎 · 2019-08-25 15:57:26

软件介绍

Mako 模板是从文本流中进行解析的,流中可以包含任意内容: XML, HTML, email 文本,等等。模板中可以包含 Mako 特定的指令(directives),可用于表示变量或表达式替换,控制结构(如条件和循环),服务器端注释,整段的 Python 代码,以及各种用于提供附加功能的标签(tags)。所有这些将被编译为真实的 Python 代码。这意味着你可以在 Mako 模板中利用 Python 几乎所有的强大特性。

使用例子:

<%inherit file="base.html"/>
<%
rows = [[v for v in range(0,10)] for row in range(0,10)]
%>
<table>
% for row in rows:
       ${makerow(row)}
% endfor
</table>
 
<%def name="makerow(row)">
   <tr>
% for name in row:
       <td>${name}</td>\
% endfor
   </tr>
</%def>

本文地址:https://codercto.com/soft/d/13148.html

Data Structures and Algorithms in Python

Data Structures and Algorithms in Python

Michael T. Goodrich、Roberto Tamassia、Michael H. Goldwasser / John Wiley & Sons / 2013-7-5 / GBP 121.23

Based on the authors' market leading data structures books in Java and C++, this book offers a comprehensive, definitive introduction to data structures in Python by authoritative authors. Data Struct......一起来看看 《Data Structures and Algorithms in Python》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码