kif1205 / Python

0 stars 0 forks source link

How would I stop a while loop after n amount of time? #27

Open kif1205 opened 5 years ago

kif1205 commented 5 years ago

https://stackoverflow.com/questions/13293269/how-would-i-stop-a-while-loop-after-n-amount-of-time

from interruptingcow import timeout try: with timeout(60*5, exception=RuntimeError): while True: test = 0 if test == 5: break test = test - 1 except RuntimeError: pass

kif1205 commented 5 years ago

This way only works in linux , not working in Windows