About 360,000 results
Open links in new tab
  1. Python Iterators - W3Schools

    Technically, in Python, an iterator is an object which implements the iterator protocol, which consist of the methods __iter__() and __next__(). Iterator vs Iterable Lists, tuples, dictionaries, and sets are all iterable objects.

  2. Using Iterations in Python Effectively - GeeksforGeeks

    Mar 6, 2023 · Use of enumerate function and zip function helps to achieve an effective extension of iteration logic in python and solves many more sub-problems of a huge task or problem. Output:

  3. Python Iterators (With Examples) - Programiz

    Iterators are methods that iterate collections like lists, tuples, etc. Using an iterator method, we can loop through an object and return its elements. Technically, a Python iterator object must implement two special methods, __iter__() and __next__(), collectively called the iterator protocol.

  4. python - What are iterator, iterable, and iteration? - Stack Overflow

    Mar 27, 2012 · In Python, iterable and iterator have specific meanings. An iterable is an object that has an __iter__ method which returns an iterator, or which defines a __getitem__ method that can take sequential indexes starting from zero (and …

  5. Iterators in Python - GeeksforGeeks

    Dec 16, 2024 · Iterables are objects that can return an iterator. These include built-in data structures like lists, dictionaries, and sets. Essentially, an iterable is anything you can loop over using a for loop. An iterable implements the __iter__ …

  6. Python Iterator: Example Code and How it Works

    Jun 24, 2024 · What is a Python iterator? Learn it here, including lots of example code to iterate lists, dictionaries, files, and generators.

  7. Python Iterators with examples: Creation and Usage Guide

    Jun 8, 2010 · In Python, an iterator is an object that can be iterated (looped) upon. An iterator returns one element at a time from a sequence, like a list, tuple, or string. Understanding iterators and how to create them is essential for writing efficient and Pythonic code.

  8. Iteration in Python: A Comprehensive Guide - CodeRivers

    Feb 22, 2025 · Iteration is the process of repeating a set of instructions a certain number of times or until a specific condition is met. In Python, iteration allows you to perform operations on each element of a collection, one by one. An iterable is an object that …

  9. Python Iter: A Comprehensive Guide to Iteration in Python

    Aug 2, 2023 · Python iteration plays a crucial role in programming, allowing us to perform repetitive tasks efficiently, iterate over data structures, and process large datasets. By understanding the ins and outs of Python iteration, you’ll be equipped with the knowledge to write efficient and concise code.

  10. Python Iterators - Python Geeks

    Iterators are Python objects that iterate over iterable objects. They follow and implement the iterator protocol. The most important method of an iterator is __next__ (). How to create Python Iterators? We can create iterators by using a function called iter (). It takes one iterable argument and returns an iterator-type object.

  11. Some results have been removed
Refresh