Nov-05-2019, 11:03 AM
Well, there are many ways of doing it. You could simply update a variable in every iteration and show the number catching the error when it occurs:
counter = 0 try: for post in takewhile(lambda p: p.date > UNTIL, dropwhile(lambda p: p.date > SINCE, posts)): print(post.date) L.download_post(post, '#bookerprize') counter += 1 except: print(f"Loop failed after {counter} iterations") else: print("Loop finished with no errors!")