row is a list of values that you can access by using indexing, like any other list.

See https://docs.python.org/3/tutorial/introduction.html#lists.

To write only specific columns to the output file, replace row with a new list containing the desired values:

for row in fileReader:
    fileWriter.writerow([row[0], row[6], row[9]])

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top