Advertisement
Nobilis

GUI Problem: script.py

May 29th, 2014
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.77 KB | None | 0 0
  1. #!/usr/bin/python
  2.  
  3. import random
  4. import string
  5. import time
  6.  
  7. char_set = string.ascii_uppercase + string.digits
  8.  
  9. class Script(object):
  10.     def __init__(self):
  11.         self.stop = False
  12.  
  13.     def suspend(self):
  14.         print 'Suspending execution...'
  15.         self.stop = True
  16.  
  17.     def run(self):
  18.         count = 0
  19.         for i in xrange(600):
  20.             num = random.randrange(10)
  21.             times = 1
  22.             if num % 3 == 0:
  23.                 times = 5
  24.             for i in xrange(times):
  25.                 print count, ''.join(random.sample(char_set*6, 6))
  26.             if not num % 5:
  27.                 time.sleep(1)
  28.             count += 1
  29.             if self.stop:
  30.                 break
  31.  
  32. if __name__ == '__main__':
  33.     s = Script()
  34.     s.run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement