Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

csv.DictReader Skip Lines

with open("myfile.csv", encoding='utf8') as fIn:
	#skip the first 100 rows 
    for i in range(100):
		#fIn.next()  # use next for python2
        fIn.readline() # use readline for python3 
	
    #open file at row 100 
    fieldnames = ["first_name","last_name"]
    reader = csv.DictReader(fIn,fieldnames=fieldnames)
	
    #now loop through file at row 101
	for row in reader:
		print(row['name'])
 
PREVIOUS NEXT
Tagged: #Skip #Lines
ADD COMMENT
Topic
Name
3+1 =