syntaxError: ‘continue’ not properly in loop

continue is only allowed within a for or while loop. You can easily restructure your function to loop until a valid request. def writeHandlesToFile(): while True: with open(“dataFile.txt”,”w”) as f: try: lst = tweepy.Cursor(tweepy.api.followers,screen_name=”someHandle”,).items(100000) print “cursor executed” for item in lst: f.write(item.screen_name+”\n”) break except tweepy.error.TweepError as e: print “In the except method” print e time.sleep(3600)

Please explain the usage of Labeled Statements

JLS 14.7 Labeled statements (edited for clarity) Statements may have label prefixes (Identifier : Statement). The Identifier is declared to be the label of the immediately contained Statement. Unlike C and C++, the Java programming language has no goto statement; identifier statement labels are used with break (§14.15) or continue (§14.16) statements appearing anywhere within … Read more

Is there a difference between “pass” and “continue” in a for loop in Python?

Yes, they do completely different things. pass simply does nothing, while continue goes on with the next loop iteration. In your example, the difference would become apparent if you added another statement after the if: After executing pass, this further statement would be executed. After continue, it wouldn’t. >>> a = [0, 1, 2] >>> … Read more