English
Tamil Nadu Board of Secondary EducationHSC Science Class 12

What is the use of the next() function? - Computer Science

Advertisements
Advertisements

Question

What is the use of the next() function?

Short Answer

Solution

The next() function in Python is used to retrieve the next item from an iterator. If the iterator is exhausted, it raises a StopIteration exception. You can also provide a default value to be returned if the iterator is exhausted, preventing the exception. 

Syntax: 

next(iterator, default_value)
shaalaa.com
Creating a CSV File Using Notepad (or Any Text Editor)
  Is there an error in this question or solution?
Chapter 13: Python and CSV files - Evaluation [Page 266]

APPEARS IN

Samacheer Kalvi Computer Science [English] Class 12 TN Board
Chapter 13 Python and CSV files
Evaluation | Q 4. | Page 266
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×