Scroll Down to See All▾
absaiterallanextanyasciibinboolbreakpointbytearraybytescallablechrclassmethodcompilecomplexdelattrdictdivmodenumerateevalexecfilterfloatformatfrozensetgetattrglobalshasattrhashhelphexidinputintisinstanceissubclassiterlenlistlocalsmapmaxmemoryviewminobjectoctopenordpowprintpropertyrangereprreversedroundsetsetattrslicesortedstaticmethodstrsumsupertupletypevarszip__import__clear_(dict)clear_(list)clear_(set)copy_(dict)copy_(list)copy_(set)fromkeysgetitemskeyspop_(dict)pop_(list)pop_(set)popitemsetdefaultupdatevaluescount_(tuple)count_(list)count_(str)index_(tuple)index_(list)index_(str)adddifferencedifference_updatediscardintersectionintersection_updateisdisjointissubsetissupersetremove_(set)remove_(list)symmetric_differencesymmetric_difference_updateunionupdateclosefilenoflushisattyreadreadablereadlinereadlinesseekseekabletelltruncatewritablewritewritelinesappendextendinsertreversesortcapitalizecasefoldcenterencodeendswithexpandtabsfindformatisalnumisalphaisasciiisdecimalisdigitisidentifierislowerisnumericisprintableisspaceistitleisupperjoinljustlowerlstripmaketranspartitionreplacerfindrindexrjustrpartitionrsplitrstripsplitsplitlinesstartswithstripswapcasetitletranslateupperdirzfillFunction Details: next
Description
Retrieves the next item from the iterator.
Extended Description
The next() function retrieves the next item from the given iterator. If a default value is provided, it is returned when the iterator is exhausted; otherwise, StopIteration is raised. This function is equivalent to calling the __next__() method on the iterator object.
Read More about next from Python Documentation
Function Signature
next(iterator: Iterator, default: Optional[Any] = None) -> Any
Module: builtins
Parameters
Parameter List
- iterator: Iterator
- default: Optional[Any]
Return
Returns the next item from the iterator. If the iterator is exhausted, returns the default value if provided, otherwise raises StopIteration.
Return Type
Any
Output
Explanation
This example demonstrates basic usage of next() with a list iterator, including what happens when the iterator is exhausted.