Last active
February 1, 2017 02:58
-
-
Save m5knt/dcdfb430924d21d01bdff2dccc7e7110 to your computer and use it in GitHub Desktop.
python3 で 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
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
import csv | |
import codecs | |
sheet = csv.reader(codecs.open('foo.csv', 'r', 'utf-8')) | |
all = [x for x in sheet] | |
for x in all: | |
print(x[1]) | |
# 一行目をキーとする方法 | |
sheet = csv.DictReader(codecs.open('foo.csv', 'r', 'utf-8')) | |
all = [x for x in sheet] | |
for x in all: | |
print(x['dat']) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment