Advertisement
Guest User

Untitled

a guest
Dec 7th, 2019
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.54 KB | None | 0 0
  1. import threading
  2. import time
  3. from random import choice
  4. from string import ascii_letters
  5.  
  6. def Sort():
  7.     while True:
  8.         time.sleep(5)
  9.         file = open('Laba7.txt','w')
  10.         list.sort(key=str.upper)
  11.         file.write(str(list))
  12.         file.close()
  13. def Print():
  14.     while True:
  15.         print(list)
  16.         time.sleep(1)
  17. list = []
  18. T1 = threading.Thread(target=Sort)
  19. T2 = threading.Thread(target=Print)
  20. T1.start()
  21. T2.start()
  22. while True:
  23.     list.append(''.join(choice(ascii_letters) for i in range(6)))
  24.     time.sleep(1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement