python html生成器 [英] python html generator
本文介绍了python html生成器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
http://www.decalage.info/python/html
但是没有办法为表格添加css元素(id,class)。
<如果你想要程序化生成而不是模板化,Karrigell的 .net / en / htmltags.htmlrel =nofollow noreferrer> HTMLTags 模块是一种可能性;它可以包括例如
class
属性(它可能是Python中的保留字),它是通过大写它的首字母,即引用我刚刚提供的doc URL:
具有与
相同名称的属性Python关键字(类,类型)必须是
大写:
print DIV('bar',Class =title)==> < DIV class =title>栏< / DIV>
I am looking for an easily implemented html generator for python. I found this one
http://www.decalage.info/python/html
but there is no way to add css elements (id, class) for table.
thx
解决方案
If you want programmatic generation rather than templating, Karrigell's HTMLTags module is one possibility; it can include e.g. the class
attribute (which would be a reserved word in Python) by the trick of uppercasing its initial, i.e., quoting the doc URL I just gave:
Attributes with the same name as Python keywords (class, type) must be capitalized :
print DIV('bar', Class="title") ==> <DIV class="title">bar</DIV>
这篇关于python html生成器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文