Advertisement
Guest User

Untitled

a guest
May 17th, 2016
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. import sys
  2.  
  3. output_file = open('output1.txt', 'a')
  4.  
  5. def get_lines():
  6. with open(sys.argv[1], 'r') as input_file:
  7. for line in input_file:
  8. yield line
  9.  
  10. for line in get_lines():
  11.  
  12. try:
  13. newline = int(line)
  14.  
  15. except ValueError:
  16. output_file.write(line)
  17. pass
  18.  
  19. output_file.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement