[英]How can i start at a line with a csv file in python?
import glob
import csv
with open('last30daysdisabled.csv') as f:
reader = csv.reader(f)
for line in reader:
print(line)
How would i go about turning this into a list? 我将如何将其转换为列表?
Use enumerate()
you can have the line number as below, by default the count start
is starting from 0, you can force it starting from 1: 使用enumerate()
你可以有如下的行号,默认情况下计数start
从0开始,你可以迫使它从1开始:
for line_number, line in enumerate(reader,start=1):
if line_number > 3:
print(line)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.