pip install Genshi python from genshi.template import TemplateLoader python loader = TemplateLoader(path_to_templates_directory) python template = loader.load('template_name.html') python stream = template.generate(data=data_dictionary) python output = stream.render('xhtml') print(output) python from genshi.template import TemplateLoader loader = TemplateLoader('templates/') template = loader.load('index.html') data = { } stream = template.generate(**data) output = stream.render('xhtml') print(output)


上一篇:
下一篇:
切换中文