For anyone who has the same problem in the future, the solution is to remove the extra line.
writer=csv.DictWriter(f,fieldnames=fieldnames, lineterminator="\n")
Although it can be read with the extra line spacing by changing
This:
namesList = [x[0] for x in people]
To this:
namesList = [x[0:1] for x in people]
(in my example) blank results are shown so removing the extra line is a better solution.
solved ‘IndexError: list index out of range’ – reading & writing from same csv file [closed]