import csv
from itertools import islice
with open('表格/2019-04-01.csv', 'r') as read_file:
    reader = csv.reader(read_file)
    for row in islice(reader, 1, None):
        print(row)

如果需要跳过第一行,可以每次判断行数是否为1。但这样写的代码执行效率偏低,因为每次都需要判断当前的行号。

使用Python提供的itertools工具,我们可以避免此类问题。itertools的目的就是为了提搞looping的效率。

Python csv 跳过第一行 去除表头 读取文件内容

 

相关文章:

  • 2021-12-20
  • 2021-11-09
  • 2021-10-03
  • 2021-11-12
  • 2022-12-23
  • 2021-11-01
猜你喜欢
  • 2022-01-06
  • 2022-12-23
  • 2021-11-23
  • 2021-11-19
  • 2021-05-29
  • 2022-02-09
  • 2022-12-23
相关资源
相似解决方案