如何在XIST python modu中设置元素类属性

2024-09-28 17:06:23 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在处理这个xist的html生成代码,我已经为文档准备好了总体结构,但是我已经准备好开始用它们的类标记所有的元素,以便以后用CSS进行样式化。我正在努力找出如何用class属性标记元素。如果我做了像。。。你知道吗

with html.td() :
    with xsc.addattr("class" ) :
        +xsc.Text("ColumnHeader")
    +xsc.Text( "Image Name" )

我将得到以下错误

Traceback ...
ll.xist.xsc.IllegalAttrError: no local attribute with Python name 'class' in <attrs class ll.xist.ns.html:td.Attrs with 32 attrs at 0x2a0bed8>

Tags: 代码text文档标记元素htmlwith结构