python - number of rows in two files different--> make equal by deleting from end -
open(filename,"r") f: reader = csv.reader(f,delimiter = ",") data = list(reader) rownum = len(data) open(filename2,"r") f: reader2 = csv.reader2(f,delimiter = ",") data2 = list(reader2) rownum2 = len(data) if rownum > rownum2: delete(rownum until rownum = rownum2 @ end)
it's pretty simple.
data = data[:max(rownum, rownum2)] data2 = data2[:max(rownum, rownum2)]
Comments
Post a Comment