Python 3 Tutorial: How To Use The Iter Method and Next Method In Python 3

preview_player
Показать описание
In this Python 3 tutorial, we will look at two methods. First method is the iter() method and the second is the next() method. These two methods work together to create iteration object and iterate through the iteration object. If you have any questions about the iter method or the next method let us know.

Be sure to like, share and comment to show your support for our tutorials.

=======================================
======================================
Рекомендации по теме
Комментарии
Автор

If you have any questions please do not hesitate to ask

LearnpythontutorialFree
Автор

The fact that you need to call the __iter__ method first is because the original object has not the __next__ special method in it (try dir() to check). The for loop does this by it's own: it first calls the __iter__ and then the __next__.

If you where to go line by line in a file buit-in type you do not need the __iter__ first step because the type has already the __next__.

I am learning so explaining helps me remembering....sorry if i said something wrong!

martinriveros
Автор

thank you very much, i was looking for a very simple explanation with an example.

Автор

thank you for the points.but the question is what if i left one of these methods

miebalenigus
Автор

how to did you make python instead of python3 your default interpreter of python3 in mac

sanskarjethi