Indentation in function does not work as expected

后端 未结 3 501
盖世英雄少女心
盖世英雄少女心 2020-12-12 01:56

I found something that doesn\'t make sense to me. I am hoping that someone can explain it.

def test(word):
    total = 0
    for l in word:
        print l

         


        
3条回答
  •  一生所求
    2020-12-12 02:48

    I am 100% sure that return total in the second function is on the same level (indented exactly) as print. Probably you use mixed space characters (tab or space).

提交回复
热议问题