# sleep for a random amount of time # here is another sleep example import time import random random.seed() for i in xrange(10): n = random.random() print str(i) + ": sleep for seconds: " + str(n) time.sleep(n) #output (for this run): #0: sleep for seconds: 0.611660870691 #1: sleep for seconds: 0.0712530683474 #2: sleep for seconds: 0.74601244734 #3: sleep for seconds: 0.942065303858 #4: sleep for seconds: 0.880462544493 #5: sleep for seconds: 0.315049974845 #6: sleep for seconds: 0.446147135853 #7: sleep for seconds: 0.306590705779 #8: sleep for seconds: 0.420561109255 #9: sleep for seconds: 0.950325171948
A python example based blog that shows how to accomplish python goals and how to correct python errors.
Wednesday, September 16, 2009
Python - sleep and random
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment