Lets say that I have a function:
from time import sleep def doSomethingThatTakesALongTime(number): print number sleep(10)
and then I call it in a for loop
for number in range(10): doSomethingThatTakesALongTime(number)
How can I set it up so that it only takes 10 seconds TOTAL to print:
$ 0123456789
Instead of taking 100 seconds. If this helps, I am going to use the information you provide for asynchronous web scraping. that is, I have a list of sites that I want to visit, but I want to visit them at the same time, and not wait for each of them to complete.
jessh source share