+ 2
How to handle a try/except so it doesn't stop iterating
The program detects dates in the format dd/mm/yyyy. I would like my list of invalid_dates to include all of them, not just the first it finds. How should I organize my try/except so it can continue iterating after finding an exception? (full description in the code) https://code.sololearn.com/cIvgf8piFf3o/?ref=app
3 RĂ©ponses
+ 4
Maybe you can add a âforâ loop before the try/except block.
For example:
for i in ......(an iterator)
try:
............(do sth with i)
except:
............(do sth else)
+ 1
đđđ