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