当前位置: 首页>>代码示例>>Python>>正文


Python SubElement.attrib["TIME_VALUE"]方法代码示例

本文整理汇总了Python中xml.etree.ElementTree.SubElement.attrib["TIME_VALUE"]方法的典型用法代码示例。如果您正苦于以下问题:Python SubElement.attrib["TIME_VALUE"]方法的具体用法?Python SubElement.attrib["TIME_VALUE"]怎么用?Python SubElement.attrib["TIME_VALUE"]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在xml.etree.ElementTree.SubElement的用法示例。


在下文中一共展示了SubElement.attrib["TIME_VALUE"]方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _retrieve_aditional_information

# 需要导入模块: from xml.etree.ElementTree import SubElement [as 别名]
# 或者: from xml.etree.ElementTree.SubElement import attrib["TIME_VALUE"] [as 别名]
    def _retrieve_aditional_information(self):
        """This method retrieve all the elan
        core file, except the ANNOTATION tags,
        to make it possible to reconstruct the
        elan file again.

        Returns
        -------
        meta_information : ElementTree
            Element with all the elan elements except the Tiers
            annotations.

        """

        meta_information = Element(self.root._root.tag, self.root._root.attrib)

        for element in self.tree:
            if element.tag != 'ANNOTATION_DOCUMENT':
                if element.tag == 'TIER':
                    meta_information.append(Element(
                        element.tag, element.attrib))
                else:
                    parent_element = SubElement(meta_information, element.tag,
                                                element.attrib)
                    for child in element:
                        other_child = SubElement(parent_element, child.tag,
                                                 child.attrib)

                        # Update time_slots
                        if other_child.tag == "TIME_SLOT" and \
                                "TIME_VALUE" not in other_child:
                            other_child.attrib["TIME_VALUE"] = \
                                "{0}".format(self.time_order[
                                    other_child.attrib["TIME_SLOT_ID"]])

                        if not str(child.text).isspace() or \
                                child.text is not None:
                            other_child.text = child.text

        return meta_information
开发者ID:cidles,项目名称:poio-api,代码行数:42,代码来源:elan.py


注:本文中的xml.etree.ElementTree.SubElement.attrib["TIME_VALUE"]方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。