runnig

split lines to separate files

Sep 5th, 2016
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.21 KB | None | 0 0
  1. input_filename = "input.txt"
  2. line_no = 0
  3. for line in open(input_filename):
  4.   output_filename = "output" + str(line_no) + ".txt"  
  5.   with open(output_filename, "w") as fp:
  6.     fp.write(line)
  7.   line_no += 1
Advertisement
Add Comment
Please, Sign In to add comment