import csv
with open('newdat.csv', 'w') as csvfile:
    spampwriter = csv.writer(csvfile, delimiter=',')
for item in ii1:
    for i in w:
        if i % 2 != 0:
            spampwriter.writerrow((s1, item, i, list1[item - 1], er2))
else:
    spampwriter.writerrow((s1, item, i, list1[item - 1], er1))
How should I format my file wite?