>>> a=[1,2,3,4,5,6]
>>> iter(a)
<listiterator object at 0x7f96f3273950>
>>> next(a)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: list object is not an iterator
>>> ia=iter(a)
>>> next(a)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: list object is not an iterator
>>> next(ia)
1
왜 다음 (a) 다음 (ia) 파이썬에서 목록의 첫 번째 요소를 반환하는 동안 오류가 발생합니까? 왜 그런가?다음 (a) 다음 (ia)이 파이썬에서 목록의 첫 번째 요소를 반환하는 동안 오류가 발생하는 이유는 무엇입니까?
list object is not an iterator
당신이 현재 위치를 가질 필요가 시퀀스를 반복 할 수 있으려면 그는 것을 의미하기 때문에 목록이의 개념이 없습니다 :
'TypeError : 목록 객체가 이해할 수없는 반복자가 아닙니다.'라는 오류 메시지가 있습니까? – EdChum
예 @EdChum 말씀해 주시겠습니까? –