1. 程式人生 > >python:在csv檔案每行末寫入一列——方法1

python:在csv檔案每行末寫入一列——方法1

with open(os.path.join(os.path.dirname(__file__), "file1")) as csvFile:
    rows = csv.reader(csvFile)
    with open(os.path.join(os.path.dirname(__file__), "file2"), 'w') as f:
        writer = csv.writer(f)
        for row in rows:
            row.append(“123465”)
            writer.writerow(row)