Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x genshi代码段重用使用硬编码的额外标记_Python 3.x_Xml_Genshi - Fatal编程技术网

Python 3.x genshi代码段重用使用硬编码的额外标记

Python 3.x genshi代码段重用使用硬编码的额外标记,python-3.x,xml,genshi,Python 3.x,Xml,Genshi,我在genshi中重复使用了这个片段,当我调用它时,它工作得很好 <a py:def="check_nd_data(input)"> <py:choose test=""> <py:when test="input.startswith('test') == False"> <Dt>${input}</Dt>

我在genshi中重复使用了这个片段,当我调用它时,它工作得很好

      <a py:def="check_nd_data(input)">
        <py:choose test="">
        <py:when test="input.startswith('test') == False">
            <Dt>${input}</Dt>
        </py:when>
        <py:otherwise>
             <NoData>${input}</NoData>
        </py:otherwise>
        </py:choose>
      </a>

${input}
${input}
正如许多人所理解的,代码片段的全部要点是能够创建一次并在多个地方使用它。所以我不希望输出有额外的硬编码标签

<a> </a>

输入前后。请问我如何做到这一点