Created
December 26, 2013 07:18
-
-
Save tao4yu/8130796 to your computer and use it in GitHub Desktop.
Jinja2 startup 入门
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from jinja2 import Environment, FileSystemLoader | |
import os | |
CURRENT_DIR = os.path.dirname(os.path.abspath(__file__)) | |
env = Environment(loader=FileSystemLoader(CURRENT_DIR), trim_blocks=True) | |
template = env.get_template("template.xml") | |
# 利用数据(字典数据文件或 key-value对)渲染模板 | |
print template.render(taskData) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment