python中Mako库怎么用?

Python (176) 2023-04-24 15:56:35

本文教程操作环境:windows7系统、Python 3.9.1,DELL G3电脑。

Mako的优点:

学习成本低,能够在结构上进行转义。

应用方向:

文本文件生成。

模块引用:

frommako.templateimportTemplate

基本用法:

frommako.templateimportTemplate
t=Template('helloworld!')
printt.render()

这里给大家调用的是Template 类,与Mako库的搭配,可以创建模板,这也是最基础的应用,好啦,本章内容到此结束,希望可以帮助大家学习。

THE END

发表回复