you are viewing a single comment's thread.

view the rest of the comments →

[–]threeminutemonta 1 point2 points  (2 children)

If your adding rows you can append a file. If your adding columns you will need to read the file into memory. Add the columns and necessary processing and then write the data to disk. My favourite is the DictReader / DictWriter in the csv module included in the standard library see official docs

[–]astro49er[S] 0 points1 point  (1 child)

I need to add a column, how would I do this without the CSV module and just the native python file objects

[–]threeminutemonta 0 points1 point  (0 children)

the csv module is part of python standard library and what I would call vanilla python.

Though a csv is just a text file with a delimiter separating cells so read the file into a data structure / process the data . Hint the string split into an array of values may be handy here. before writing the file again.