I know how to remove lines in a CSV file, however looking at removing multiple lines in multiple CSV files.
that's my code:
import csv
import os
import glob
myfiles = glob.glob('*.csv',recursive=False)
with open(myfiles, 'r') as fin:
data = fin.read().splitlines(True)
with open(myfiles, 'w') as fout:
fout.writelines(data[5:])
I want to achieve the following: 1) Iterate through current directory. 2) Remove first 4 lines in a CSV file and save it.