Skip to content

Instantly share code, notes, and snippets.

@chadfurman
Created November 4, 2020 23:42
Show Gist options
  • Save chadfurman/d196bc9318fbe1215d83d90efda0be55 to your computer and use it in GitHub Desktop.
Save chadfurman/d196bc9318fbe1215d83d90efda0be55 to your computer and use it in GitHub Desktop.
import csv
def csv_reader(filename: str, operation: callable) -> None:
with open(filename,'rt') as f:
data = csv.reader(f)
for row in data:
counter += 1
if counter < 1:
continue # skip first row, it's a header
operation(row)
def process_row(row):
print(row[0]) # first column
print(row[1]) # second column
helpers.csv_reader('./local_file.csv', process_row)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment