Python注释缩进不得当导致IndentationError: unexpected indent

def test():
    i=0
'''
aaaaaa
'''
    while i < 5:
    '''
    bbbbbb
    '''        
        print(i)
        i+=1
        
if __name__ == '__main__':
    test()

如上,Python注释的缩进不得当,也会导致IndentationError: unexpected indent。将注释的缩略修改如下后解决。

def test():
    i=0
    '''
    aaaaaa
    '''
    while i < 5:
        '''
        bbbbbb
        '''        
        print(i)
        i+=1
        
if __name__ == '__main__':
    test()

 

posted on 2019-03-23 20:51  MuenPaPa  阅读(2772)  评论(0编辑  收藏  举报