with open('test.csv', 'wb') as f:
    wtr = csv.writer(f, delimiter=' ')
wtr.writerows([[1, 2], [2, 3], [4, 5]])
with open('test.csv', 'r') as f:
    for line in f:
        pass
How do I write data to csv file in columns and rows from a list in python?