이 문제를 해결할 수 있습니까? 나는 그것을 실행할 때예기치 않은 들여 쓰기 - Python def
def group_iter (iterator, n=2, strict=False):
accumulator = []
accumulator.append(item)
if len(accumulator) == n:
yield tuple(accumulator)
accumulator = []
if strict and len(accumulator) !=0:
raise ValuseError("Leftover values")
print "This is count %r " % group_iter
와 나는 얻을 :
accumulator.append (item)
IndentationError: unexpected indent
가 어떻게이 문제를 해결할 수 있습니까? 감사!
'if len (accumulator) == n :'외에도 들여 쓰기가 없습니다. –
서식이 잘못되었습니다. –
'accumulator = []'뒤에 코드를 들여 쓸 이유가 없습니다. – Nicolas