SHARE
TWEET

Untitled

a guest Dec 10th, 2019 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import random
  2. from random import randint
  3.  
  4. list3 = []
  5. list2 = []
  6. list1 = []
  7.  
  8.  
  9. def main():
  10.     f = open("test1.txt", "r")
  11.     f1 = f.readlines()
  12.     f.close()
  13.     for x in f1:
  14.         x = int(x.strip())
  15.  
  16.         list1.append(x)
  17.     print(list1)
  18.    
  19.  
  20.     f = open("test2.txt", "r")
  21.     f2 = f.readlines()
  22.     f.close()
  23.     for x in f2:
  24.         x = int(x.strip())
  25.  
  26.         list2.append(x)
  27.  
  28.     print(list2)
  29.  
  30.     list3 = (list1 + list2)
  31.  
  32.     list3.sort()
  33.     print(list3)
  34.  
  35.     f3 = open("test3.txt", "w")
  36.     f3.writelines(str(list3))
  37.     # for x in list3:
  38.  
  39.     #   f3.write(x)
  40.     f3.close()
  41.     print(list3)
  42.  
  43.  
  44. if __name__ == "__main__":
  45.     main()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top