Last active
June 9, 2016 08:00
-
-
Save kurozumi/7ecd16e59ff5d3e0a453f059d91d6057 to your computer and use it in GitHub Desktop.
【Python】CSVを読み込むジェネレータ関数
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
def csv_reader(file, header=False): | |
import csv | |
with open(file, "r") as f: | |
reader = csv.reader(f) | |
if header | |
next(reader) | |
for row in reader: | |
yield row |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment