📜  python csv reader skip header - Python代码示例

📅  最后修改于: 2022-03-11 14:45:27.168000             🧑  作者: Mango

代码示例2
with open("tmob_notcleaned.csv", "rb") as infile, open("tmob_cleaned.csv", "wb") as outfile:
   reader = csv.reader(infile)
   next(reader, None)  # skip the headers
   writer = csv.writer(outfile)
   for row in reader:
       # process each row
       writer.writerow(row)

# no need to close, the files are closed automatically when you get to this point.