當沒有元素時,則引發 StopIteration 此例外。若要實作自己的迭代器,則只要實作 next() (Python 2)或 __next__() ( Python 3)。 以下為兩個例子:.
確定! 回上一頁