Advertisement
DrunkBear

R

Mar 20th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. import operator
  2.  
  3. file = open('input.txt')
  4. stack = []
  5. s = ''
  6.  
  7. i = 0
  8. for line in file:
  9. line = line.strip()
  10. if i == 0:
  11. i += 1
  12. else:
  13. stack.append(line.split())
  14.  
  15. file.close()
  16.  
  17. stack = sorted(stack, key = operator.itemgetter(0))
  18.  
  19. file = open('output.txt', 'w')
  20. for i in stack:
  21. file.write(' '.join(i) + '\n')
  22. #print(i)
  23. file.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement