Advertisement
makispaiktis

TXT -> 2 TXT files

Nov 13th, 2021 (edited)
620
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.53 KB | None | 0 0
  1. def convert(filename)
  2.     destinationName = "output.txt"
  3.     file = open(filename, 'r')
  4.     destination = open(destinationName, 'w')
  5.  
  6.     counterLine = 0
  7.     for line in file:
  8.         counterLine += 1
  9.         if counterLine > 3:
  10.             newLine = ''
  11.             for letter in line:
  12.                 if letter != ',':
  13.                     newLine += letter
  14.             destination.write(newLine)
  15.  
  16. # MAIN FUNCTION
  17. filenames = ["Wilkinson_normS21.TXT", "Wilkinson_normS21.TXT"]
  18. for filename in filenames:
  19.     convert(filename)
  20.  
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement