Guest User

Untitled

a guest
Dec 10th, 2019
104
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import random
  2. from random import randint
  3.  
  4.  
  5. list3 = []
  6. list2 = []
  7. list1 = []
  8. def main():
  9. f = open("test1.txt", "r")
  10. f1 = f.readlines()
  11. for x in f1:
  12. x = x.strip()
  13. list1.append(x)
  14. #list1.append(randint(0, 100))
  15. print(list1)
  16. f= open("test2.txt", "r")
  17. f2 = f.readlines()
  18. for x in f2:
  19. x = x.strip()
  20. list2.append(x)
  21. print(list2)
  22. list3=(list1 + list2)
  23.  
  24. list3.sort()
  25. print(list3)
  26.  
  27. f3 = open("test3.txt","w")
  28. f3.writelines(list3)
  29. #for x in list3:
  30.  
  31. # f3.write(x)
  32. f3.close()
  33. print(list3)
  34.  
  35. if __name__ == "__main__":
  36. main()
RAW Paste Data