Apr-05-2022, 04:23 AM
You can provide a default value for next() to return when the a StopIteration exception occurs. For bowlofred's example you would use: next_word = next(words, "")
Skipping line in text without Restarting Loop
|
|
Messages In This Thread |
Skipping line in text without Restarting Loop - by IdMineThat - Apr-05-2022, 02:16 AM
RE: Skipping line in text without Restarting Loop - by deanhystad - Apr-05-2022, 03:20 AM
RE: Skipping line in text without Restarting Loop - by bowlofred - Apr-05-2022, 03:24 AM
RE: Skipping line in text without Restarting Loop - by IdMineThat - Apr-05-2022, 03:32 AM
RE: Skipping line in text without Restarting Loop - by deanhystad - Apr-05-2022, 04:23 AM
|