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


Python Element.text方法代码示例

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


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

示例1: to_tree

# 需要导入模块: from openpyxl.xml.functions import Element [as 别名]
# 或者: from openpyxl.xml.functions.Element import text [as 别名]
 def to_tree(self, tagname):
     """
     Return as XML node
     """
     el = Element(tagname)
     el.text = str(self)
     return el
开发者ID:sahirsharma,项目名称:Martian,代码行数:9,代码来源:header_footer.py

示例2: to_tree

# 需要导入模块: from openpyxl.xml.functions import Element [as 别名]
# 或者: from openpyxl.xml.functions.Element import text [as 别名]
 def to_tree(self, tagname=None, value=None, namespace=None):
     namespace = getattr(self, "namespace", namespace)
     if value is not None:
         if namespace is not None:
             tagname = "{%s}%s" % (namespace, tagname)
         el = Element(tagname)
         el.text = safe_string(value)
         return el
开发者ID:18600597055,项目名称:hue,代码行数:10,代码来源:nested.py

示例3: to_tree

# 需要导入模块: from openpyxl.xml.functions import Element [as 别名]
# 或者: from openpyxl.xml.functions.Element import text [as 别名]
 def to_tree(self, tagname=None, value=None, namespace=None):
     namespace = getattr(self, "namespace", namespace)
     if namespace is not None:
         tagname = "{%s}%s" % (namespace, tagname)
     el = Element(tagname)
     if value is not None:
         el.text = datetime_to_W3CDTF(value)
         return el
开发者ID:clwater,项目名称:lesson_python,代码行数:10,代码来源:core.py

示例4: _write_defined_names

# 需要导入模块: from openpyxl.xml.functions import Element [as 别名]
# 或者: from openpyxl.xml.functions.Element import text [as 别名]
def _write_defined_names(workbook, names):
    """
    Append definedName elements to the definedNames node.
    """
    for named_range in workbook.get_named_ranges():
        attrs = dict(named_range)
        if named_range.scope is not None:
            attrs['localSheetId'] = safe_string(named_range.scope)

        name = Element('{%s}definedName' % SHEET_MAIN_NS, attrs)
        name.text = named_range.value
        names.append(name)
开发者ID:Gayathri001,项目名称:cir-portal,代码行数:14,代码来源:workbook.py

示例5: to_tree

# 需要导入模块: from openpyxl.xml.functions import Element [as 别名]
# 或者: from openpyxl.xml.functions.Element import text [as 别名]
 def to_tree(self, tagname, obj, namespace=None):
     """
     Convert the sequence represented by the descriptor to an XML element
     """
     for idx, v in enumerate(obj, self.idx_base):
         if hasattr(v, "to_tree"):
             el = v.to_tree(tagname, idx)
         else:
             tagname = namespaced(obj, tagname, namespace)
             el = Element(tagname)
             el.text = safe_string(v)
         yield el
开发者ID:JLL-Benson,项目名称:CHN_DQ,代码行数:14,代码来源:sequence.py

示例6: writer

# 需要导入模块: from openpyxl.xml.functions import Element [as 别名]
# 或者: from openpyxl.xml.functions.Element import text [as 别名]
def writer(data_validation):
    """
    Serialse a data validation
    """
    attrs = dict(data_validation)
    el = Element("{%s}dataValidation" % SHEET_MAIN_NS, attrs)
    for attr in ("formula1", "formula2"):
        value = getattr(data_validation, attr, None)
        if value is not None:
            f = Element("{%s}%s" % (SHEET_MAIN_NS, attr))
            f.text = value
            el.append(f)
    return el
开发者ID:petres,项目名称:eurostat,代码行数:15,代码来源:datavalidation.py

示例7: to_tree

# 需要导入模块: from openpyxl.xml.functions import Element [as 别名]
# 或者: from openpyxl.xml.functions.Element import text [as 别名]
    def to_tree(self, tagname=None, idx=None, namespace=None):

        if tagname is None:
            tagname = self.tagname

        # keywords have to be masked
        if tagname.startswith("_"):
            tagname = tagname[1:]

        tagname = namespaced(self, tagname, namespace)
        namespace = getattr(self, "namespace", namespace)

        attrs = dict(self)
        for key, ns in self.__namespaced__:
            if key in attrs:
                attrs[ns] = attrs[key]
                del attrs[key]

        el = Element(tagname, attrs)
        if "attr_text" in self.__attrs__:
            el.text = safe_string(getattr(self, "attr_text"))

        for child_tag in self.__elements__:
            desc = getattr(self.__class__, child_tag, None)
            obj = getattr(self, child_tag)

            if isinstance(obj, seq_types):
                if isinstance(desc, NestedSequence):
                    # wrap sequence in container
                    if not obj:
                        continue
                    nodes = [desc.to_tree(child_tag, obj, namespace)]
                elif isinstance(desc, Sequence):
                    # sequence
                    desc.idx_base = self.idx_base
                    nodes = (desc.to_tree(child_tag, obj, namespace))
                else: # property
                    nodes = (v.to_tree(child_tag, namespace) for v in obj)
                for node in nodes:
                    el.append(node)
            else:
                if child_tag in self.__nested__:
                    node = desc.to_tree(child_tag, obj, namespace)
                elif obj is None:
                    continue
                else:
                    node = obj.to_tree(child_tag)
                if node is not None:
                    el.append(node)
        return el
开发者ID:olivx,项目名称:scripts,代码行数:52,代码来源:serialisable.py


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