(python)docstring导致缩进错误

(python)docstring导致缩进错误,python,indentation,Python,Indentation,没有。我所做的就是删除docstring注释。发生了什么事?确保缩进时不要将空格和制表符混合使用文档字符串以制表符开头。让您的代码只使用空格进行缩进(或只使用制表符),包括文档字符串的缩进。类似问题:空行的前导空格数量必须与周围代码的前导空格数量相同。我知道很多人都强烈反对Python,但它仍然是非常适合初学者的语言!:-)返回“”。加入(如果n.nodeType==n.TEXT\u节点,则节点列表中n的n.data) def getText(nodelist): """Extracts

没有。我所做的就是删除docstring注释。发生了什么事?

确保缩进时不要将空格和制表符混合使用

文档字符串以制表符开头。让您的代码只使用空格进行缩进(或只使用制表符),包括文档字符串的缩进。

类似问题:空行的前导空格数量必须与周围代码的前导空格数量相同。我知道很多人都强烈反对Python,但它仍然是非常适合初学者的语言!:-)<代码>返回“”。加入(如果n.nodeType==n.TEXT\u节点,则节点列表中n的n.data)
def getText(nodelist):
    """Extracts the text between XML tags

    I took this directly from http://docs.python.org/library/xml.dom.minidom.html.
    For example, if I have a tag <Tag>525</Tag> this method returns me '525'
    """
    rc = ""
    for node in nodelist:
        if node.nodeType == node.TEXT_NODE:
            rc = rc + node.data
    return rc
def getText(nodelist):
    rc = ""
    for node in nodelist:
        if node.nodeType == node.TEXT_NODE:
            rc = rc + node.data
    return rc