Advertisement
Guest User

Untitled

a guest
Aug 27th, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. import random
  2. global codes
  3. from threading import Thread
  4. ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
  5.  
  6. class makelargecode(Thread):
  7.  
  8. def __init__(self,n):
  9. Thread.__init__(self)
  10. self.n = n
  11. self.codes = ''
  12. def makecode(self):
  13. for i in range(0,10):
  14. self.codes += random.choice(ascii_uppercase)
  15. return self.codes
  16. @staticmethod
  17. def wr(code):
  18. f = open("code.txt","a+")
  19. f.write(code+"\n")
  20. f.close
  21.  
  22.  
  23. def run(self):
  24. for i in range(10000000):
  25. makelargecode.wr(makelargecode(10).makecode())
  26. print "Done"
  27.  
  28.  
  29.  
  30. if __name__ == "__main__":
  31. task = makelargecode(8)
  32. task.start()
  33. task.join()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement