"缩进错误:unindent与任何外部缩进级别都不匹配"

use*_*019 0 python

你能告诉我这段代码有什么问题吗?

def insert_sequence(str1, str2, index):
    '''The first two parameters are DNA sequences and the third parameter
       is an index. Return the DNA sequence obtained by inserting the second
       DNA sequence into the first DNA sequence at the given index.

       >>>insert_sequence('CCGG', 'AT',2)
       CCATGG

    '''
   str1 = str1[0:index] + str2 + str1[index:len(str1)]
   return str1
Run Code Online (Sandbox Code Playgroud)

Bre*_*arn 5

您的docstring比函数体的其余部分缩进了一个空格.无论是文档串一个空格还是缩进其余的一个空格(可能是后者,因为如果我算数正确,那将使它成为四个空格).