So I have a small script that looks pretty much:
for _ in range(3):
with open('test.csv', 'a', newline='') as csv_file:
writer = csv.writer(csv_file)
writer.writerow(["SN", "Name", "Contribution"])
writer.writerow([1, "Linus Torvalds", "Linux Kernel"])
writer.writerow([2, "Tim Berners-Lee", "World Wide Web"])
writer.writerow([3, "Guido van Rossum", "Python Programming"])
sys.exit()
which basically write at this something like:
However what I would like to do is to have something like:
and here basically what I can see for issue is:
- If there is no csv called test.csv then we create one and add the
Column-1, Column-2, Column-3only once at top. - If there is already a test.csv then we don't need to add the first column
Column-1, Column-2, Column-3but instead just appending into those column that is needed.
And I am not sure how I am able to do that. I would like to know how to do that.

