且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

跳过循环中的第一行(字段)使用CSV文件?

更新时间:2023-11-04 12:44:58

Probably you want something like:

firstline = True
for row in kidfile:
    if firstline:    #skip first line
        firstline = False
        continue
    # parse the line

An other way to achive the same result is calling readline before the loop:

kidfile.readline()   # skip the first line
for row in kidfile:
    #parse the line

相关阅读

推荐文章