缩进中的制表符和空格使用不一致 [英] Inconsistent use of tabs and spaces in indentation

查看:248
本文介绍了缩进中的制表符和空格使用不一致的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

def contains_sequence(dna1, dna2):
    ''' (str, str) -> bool

    Return True if and only if DNA sequence dna2 occurs in the DNA sequence
    dna1.

    >>> contains_sequence('ATCGGC', 'GG')
    True
    >>> contains_sequence('ATCGGC', 'GT')
    False

    '''
    b=False
    len2=len(dna2)
    i=0
    for j in dna1:
        temp=dna1[i:i+len2]
        if temp == dna2:
            b=True
        i=i+1
    return b

我是Python的新手.上面粘贴的程序特别在"if temp == dna2:"行给我一个错误缩进中的制表符和空格的不一致使用".有人可以帮我找出缩进的不正确之处吗?

I am new to Python. The program pasted above gives me an error "Inconsistent use of tabs and spaces in indentation" at line "if temp == dna2:" specifically. Can someone please help me out in finding out how the indentation is incorrect?

推荐答案

这意味着您在缩进中混合了空格和制表符.您必须解决此问题,使其与制表符或空格保持一致.

It means you have mixed up spaces and tabs in the indentation. You have to fix that to be consistent with either tabs or spaces.

这篇关于缩进中的制表符和空格使用不一致的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆