xmlInterface.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:Coqtail 作者: whonore 项目源码 文件源码
def _build_xml(self, tag, val=None, children=Void()):
        """Construct an xml element with a given tag, value, and children."""
        attribs = {'val': val} if val is not None else {}

        # If children is a list then convert each element separately, if it is
        # a tuple, treat it as a single element
        if isinstance(children, self.Void):
            children = ()
        elif isinstance(children, list):
            children = [self._from_value(child) for child in children]
        else:
            children = (self._from_value(children),)

        xml = ET.Element(tag, attribs)
        xml.extend(children)

        return xml
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号