Here is the function to pause or stop your code in Python for a variable amount of time:
PYTHON:
-
span style="color: #808080; font-style: italic;">#will sleep for 5 seconds
-
#will sleep for half a second
-
#will sleep for a tenth of a second
This is useful if you are making numerous calls to web services and you want to slow things down so you get more consistent results and to not get your account or ip blocked.
It is similar to pause, wait and sleep in other languages.
Here is the 'time' module reference
An interesting note in the manual: the amount of time the code is actually stopped might be slightly longer due to other activity on your computer going on at the same time.
July 30th, 2012 at 6:01 pm
Nice,… very awesome… 😀
January 10th, 2013 at 8:33 am
Its vunderbar i was able to make a dancing chocola kabelwurst with this code, lovely
January 10th, 2013 at 9:41 am
Cool! Post your code. 🙂