スクレイピングで収集したデータや、計算処理の結果を保存する際、最も手軽で汎用性が高いのがCSVファイル形式です。Excelで開くことができ、データベースへのインポートも容易なため、実務においてもデファクトスタンダードとして利用されています。
CSV(Comma Separated Values)は、カンマで値を区切った、非常にシンプルな表形式のデータフォーマットです。そのシンプルさゆえに、ついline.split(',')のように、カンマで文字列を分割して処理してしまいがちです。 しかし、この方法では、"Yamada, Taro"のように ...
Calling writer.writerow on a list of strings in python 3.5 results in TypeError: string argument expected, got 'bytes' #70 ...
jdufresne mannequin commented on Jan 5, 2015 The csv.writer.writerow () does not accept a generator as input. I find this counter-intuitive and against the spirit of similar APIs. If the generator is ...