python入門リストをCSVファイルに書き出すサンプル

2018年11月7日

サンプルコード

import csv

cft = [[2001, "yamada", "東京",21],
        [2002, "sugimura", "横浜",31],
        [2003, "yoshita", "川崎",25],
        [2004, "sakura", "大阪",26]]

with open("employeet.csv", "w") as emp:
   k = csv.writer(emp)
    for dd in cft:
        k.writerow(dd)

Python

Posted by arkgame