-
-
Save Peilonrayz/c8c5ddbcdadcd4a1112c076c00043361 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
def read_csv(path, headers=True) | |
with open(infile, newline='') as csvfile: | |
rows = csv.reader(csvfile) | |
if not headers: | |
yield from rows | |
else: | |
headers = next(rows) | |
for row in rows: | |
yield dict(zip(headers, row)) | |
for row in read_csv('test.csv'): | |
print(row['birth.place']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment