I'm having trouble finding clear and concise methods of removing a select row from a CSV using the CSV module (not the Panda since it's required to be installed). I would also like to remove a range of rows separately. Every article and every question I've seen either or abroad are not clear at all and tend to include specific logic people are asking about. I just want a clear cut answer that is very simple.
I would like to use argv to provide a filename, beginning row number, and end row numbers. So something like python Script.py /CSVfile.csv 1 5, meaning the file name and remove rows 1 through 5 (beginning and ending). I'm new to Python scripting and I get halfway there, but there is always some logic people include that isn't relevant to what I need to do. I just keep getting blocked (as I typically do when trying to code), any help is appreciated.
import csv
import sys
var1 = sys.argv[1]
var2 = sys.argv[2]
var3 = sys.argv[3]
with open (var1, 'w') as file1:
reader = csv.reader(file1)
for line in reader:
file1.writer()