python - Printing out csv rows apart from first row -
python - Printing out csv rows apart from first row -
i want read csv file in python, , print out every row apart first row.
i know how print out rows:
with open('myfile.csv', 'rb') csvfile: reader = csv.reader(csvfile, delimiter=',') row in reader: print row and way can think of not printing out first row is:
with open('myfile.csv', 'rb') csvfile: reader = csv.reader(csvfile, delimiter=',') i, row in enumerate(reader): if != 0: print row but doesn't seem elegant. other solutions?
csv reader objects iterators, means can skip single entries using next():
with open('myfile.csv', 'rb') csvfile: reader = csv.reader(csvfile, delimiter=',') next(reader) # ignore result row in reader: print row python csv
Comments
Post a Comment