4 Réponses
+ 4
an iterator is an object used to iterate across iterable objects such as lists, tuples, dicts, and sets.
the iter() method is used to initialize the iterator object.
iteration is accomplished through the usage of the next() method.
you can find a really good and simple example here also:
https://www.programiz.com/JUMP_LINK__&&__python__&&__JUMP_LINK-programming/iterator
+ 4
Yassine Belm using the references that Mihaly Nyilas and Bob_Li brought up I created this code for a quick easy to follow explanation
https://sololearn.com/compiler-playground/clBD6dRUxX2j/?ref=app
+ 2
don't forget about generators while you are learning about iterable objects.
here is a good explanation in SO
https://stackoverflow.com/questions/2776829/difference-between-pythons-generators-and-iterators
+ 1
What i understand that you copie the iterable objects in variables like (iterator=iter(name)) than you choose one character of the variable using next()