Advertisement
makispaiktis

TXT -> TXT - Trimming lines, commas

Nov 13th, 2021 (edited)
723
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.38 KB | None | 0 0
  1. filename = "Amplifier_Mod1_angleS21.TXT"
  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.  
  17.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement