Titanic: Problem with “Getting Started with Python”

To summarize for those in Python 3.5: First, you may use either “csv_file_object.__next__()” or “next(csv_file_object)” . The documentation shows that these methods are equivalent. next(iterator[, default]) Retrieve the next item from the iterator by calling its __next__() method. If default is given, it is returned if the iterator is exhausted, otherwise StopIteration is raised. iterator.__next__() Return the next item from the container. If there are no further items, raise the StopIteration exception. This method corresponds to the tp_iternext slot of the type structure for Python objects in the Python/C API. Furthermore, there appears to be no difference in how the next() method works between Python 2.7 and Python 3.5. In fact, if you compare the descriptions in both versions, you’ll find that they are completely identical. iterator.next() Return the next…


Link to Full Article: Titanic: Problem with “Getting Started with Python”

Pin It on Pinterest

Share This