Created
November 29, 2013 08:03
-
-
Save mzsm/7702773 to your computer and use it in GitHub Desktop.
CSVを、PythonのCSVリーダが想定通りにパースしてくれるか確認するツール。
確認したい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
# -*- coding: utf-8 -*- | |
import csv | |
import sys | |
def main(filepath): | |
csvfile = open(filepath) | |
for num, line in enumerate(csv.reader(csvfile)): | |
print("line {0}: ({1} fields) {2} ".format(num, len(line), line)) | |
if __name__ == '__main__': | |
main(sys.argv[1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment