Advertisement
TShiva

csv_splitting

Oct 3rd, 2019
311
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.30 KB | None | 0 0
  1. file = open("results.csv")
  2. new_file_first = open("output_fisrt.csv", 'w')
  3. new_file_second = open("output_second.csv", 'w')
  4. for line in file:
  5.     slpit = line.split(";")
  6.     for entry in slpit[0:3]:
  7.         new_file_first.write(entry+";")
  8.     new_file_first.write("\n")
  9.     new_file_second.write(slpit[3])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement